Css 带<;的多列列表;李>;
我正在使用ul/li创建wordpress类别的多列图库视图。但除第一行之外的所有行都有一个左边距 我看不出我做错了什么Css 带<;的多列列表;李>;,css,Css,我正在使用ul/li创建wordpress类别的多列图库视图。但除第一行之外的所有行都有一个左边距 我看不出我做错了什么 我是否已使用for循环解决此问题?这是由以下CSS引起的: .last-posts li:first-child { margin-left: 0px; } .last-posts li.the-post { width: 290px; min-height: 270px; float: left; margin-left: 15px; posit
我是否已使用for循环解决此问题?这是由以下CSS引起的:
.last-posts li:first-child {
margin-left: 0px;
}
.last-posts li.the-post {
width: 290px;
min-height: 270px;
float: left;
margin-left: 15px;
position: relative;
}
第235行
这将覆盖给定给的左边距
。最后使用此CSS发布li
元素:
.last-posts li:first-child {
margin-left: 0px;
}
.last-posts li.the-post {
width: 290px;
min-height: 270px;
float: left;
margin-left: 15px;
position: relative;
}
您可以去掉
:first child
CSS,或者在接收左边距:0px的行中,首先向每个帖子添加一个类代码>。这取决于您,有许多方法这是由CSS引起的:
.last-posts li:first-child {
margin-left: 0px;
}
.last-posts li.the-post {
width: 290px;
min-height: 270px;
float: left;
margin-left: 15px;
position: relative;
}
第235行
这将覆盖给定给的左边距
。最后使用此CSS发布li
元素:
.last-posts li:first-child {
margin-left: 0px;
}
.last-posts li.the-post {
width: 290px;
min-height: 270px;
float: left;
margin-left: 15px;
position: relative;
}
您可以去掉:first child
CSS,或者在接收左边距:0px的行中,首先向每个帖子添加一个类代码>。这取决于您,有许多方法这是因为您的图像上有一个左边距或填充。将其更改为右pad或margin,并确保将padding/margin宽度考虑到li
元素的宽度中:
.last-posts li.the-post {
width: 290px; <== subtract margin/padding width here
min-height: 270px;
float: left;
margin-left: 15px;
position: relative;
}
.last posts li.the-post{
宽度:290px;这是因为图像上有左边距或边距。请将其更改为右边距或边距,并确保将边距/边距宽度纳入li
元素的宽度:
.last-posts li.the-post {
width: 290px; <== subtract margin/padding width here
min-height: 270px;
float: left;
margin-left: 15px;
position: relative;
}
.last posts li.the-post{
宽度:290px;由于应用于该容器的:第一个子项的样式,第一个列表项上没有边距。您可以使用
.last-posts li:nth-child(3n+1) {
margin-left: 0;
}
这将以三列显示您的列表项,我想这是您想要的。由于应用于该容器的:第一个子项的样式,第一个列表项上没有边距。您可以使用
.last-posts li:nth-child(3n+1) {
margin-left: 0;
}
这将以三列形式显示列表项,我想这是您想要的。在css中,您设置了一个左边距:
.last-posts li.the-post {
width: 290px;
min-height: 270px;
float: left;
margin-left: 15px;
position: relative;
}
第一行之后的每一行的间距都会偏移。在css中,您设置了一个左边距:
.last-posts li.the-post {
width: 290px;
min-height: 270px;
float: left;
margin-left: 15px;
position: relative;
}
间距在第一行之后偏移每行。好建议,对于n个子项
,除了IE之外,自然很好!好建议,对于n个子项
,除了IE之外,自然很好!