一个html有两个同名class,html 加载多个class,有的只加载了一个,有的两个都加载了,为何?_html/css_WEB-ITnose...

spe_top banner_top 和 spe_top banner_top 这两个分别只有一个有效

header_img spe_img 两个都有效

HTML 代码

回复讨论(解决方案)

.spe_header{height:150px;}.header{background:#0CC repeat;height:700px;color:white;}.banner_top{background:rgb(0, 229, 238) repeat;height:700px;position:relative;top:0;}.header_img{margin:0 auto;width:70%;height:800px;background:url(../images/banner.jpg) no-repeat;background-size:cover;position:absolute;top:0;left:230px;}.spe_img{height:150px;}.spe_top{height:150px;}/*同样优先级的选择器,相同属性的样式,写在后面的会覆盖前面的,要把这行放到后面*/

不是这个意思啊,是有个选择器根本没效果,开始放不了图

spe_top banner_top 和 spe_top banner_top 这两个分别只有一个有效

header_img spe_img 两个都有效

.spe_header{height:150px;}.header{background:#0CC repeat;height:700px;color:white;}.banner_top{background:rgb(0, 229, 238) repeat;height:700px;position:relative;top:0;}.header_img{margin:0 auto;width:70%;height:800px;background:url(../images/banner.jpg) no-repeat;background-size:cover;position:absolute;top:0;left:230px;}.spe_img{height:150px;}.spe_top{height:150px;}/*同样优先级的选择器,相同属性的样式,写在后面的会覆盖前面的,要把这行放到后面*/

不是这个意思啊,是有个选择器根本没效果,开始放不了图

spe_top banner_top 和 spe_top banner_top 这两个分别只有一个有效

header_img spe_img 两个都有效

楼主什么结贴率????

哦。。。。。

被覆盖了。

.spe_top{height:150px;}

.banner_top{background:rgb(0, 229, 238) repeat;height:700px;position:relative;top:0;}

第一个肯定不起作用 了,你看看你写的第二个样式就知道了。

赶紧结贴了吧,我都不好意思回复了!

感谢大家,主要是注释的问题,优先级也没怎么搞清楚,问题已解决

声明:本文原创发布php中文网,转载请注明出处,感谢您的尊重!如有疑问,请联系admin@php.cn处理

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值