[英]How to make class inner ul li css
The following css style be like this: 以下CSS样式如下所示:
ul {
padding:0 0 0 0;
margin:0 0 0 0;
}
#foo li {
list-style:none;
margin-bottom:25px;
}
ul li img {
cursor: pointer;
}
The ul li has included: ul包括:
<ul id="foo" class="row">
<li class="col-lg-3 col-md-3 ">
<img class="img-responsive" src="images/photodune-174908-rocking-the-night-away-xs.jpg">
</li>
</ul>
Is it possible to change #ul from id into class ? 可以将#ul从id更改为class吗? I tried be like this:
我试过像这样:
ul {
padding:0 0 0 0;
margin:0 0 0 0;
}
li.bar {
list-style:none;
margin-bottom:25px;
}
ul li img {
cursor: pointer;
}
<ul id="" class="row bar">
<li class="col-lg-3 col-md-3 ">
<img class="img-responsive" src="images/photodune-174908-rocking-the-night-away-xs.jpg">
</li>
</ul>
It works but there's something wrong that I think it's not working as well. 它可以工作,但是我认为有些不对劲。
Since your li
tag doesn't have the .bar
class it can't work. 由于您的
li
标记没有.bar
类,因此无法使用。
If you want to style the li
change the css to: 如果要设置
li
样式,请将CSS更改为:
.bar li {
list-style:none;
margin-bottom:25px;
}
or 要么
if you want to style the ul
change the css to: 如果要样式化
ul
请将CSS更改为:
ul.bar {
list-style:none;
margin-bottom:25px;
}
With your css code you style a li
tag with the .bar
class. 使用CSS代码,您可以使用
.bar
类对li
标签进行样式设置。
Try this instead 试试这个
ul.bar li{
list-style:none;
margin-bottom:25px;
}
Or this 或这个
.bar li{
list-style:none;
margin-bottom:25px;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.