Html 添加父元素类时,CSS相邻同级选择器失败
这很好用Html 添加父元素类时,CSS相邻同级选择器失败,html,css,Html,Css,这很好用 .content-wrapper.row-fluid + .footer.row-fluid { margin-top: 40px; } 这仅在正文已分类的页面上成功地将兄弟姐妹正确地定位到path frontpage .path-frontpage .footer.row-fluid {} .path-frontpage .content-wrapper.row-fluid {} 这适用于正文分类为path frontpage .path-frontpage .foo
.content-wrapper.row-fluid + .footer.row-fluid {
margin-top: 40px;
}
这仅在正文已分类的页面上成功地将兄弟姐妹正确地定位到path frontpage
.path-frontpage .footer.row-fluid {}
.path-frontpage .content-wrapper.row-fluid {}
这适用于正文分类为path frontpage
.path-frontpage .footer.row-fluid {}
.path-frontpage .content-wrapper.row-fluid {}
但这不会将正文分类为路径frontpage
的页面的页脚页边距顶部设置为零。Chrome inspector显示第一条规则生效。为什么?或者更确切地说-如何仅在具有body classpath frontpage
的页面上使边距为负数
.path-frontpage .content-wrapper.row-fluid + .path-frontpage .footer.row-fluid {
margin-top: 0px;
}
真实用法
.path-frontpage .content-wrapper.row-fluid + .footer.row-fluid {
margin-top: 0px;
}
为了让代码正常工作,html应该是这样的
div{border:1px solid#ff0000;高度:30px;}
.content-wrapper.row-fluid+.footer.row-fluid{
边缘顶端:40px;
}
.path frontpage.content-wrapper.row-fluid+.path frontpage.footer.row-fluid{
边际上限:0px;
}
包装纸
页脚
真实用法
.path-frontpage .content-wrapper.row-fluid + .footer.row-fluid {
margin-top: 0px;
}
为了让代码正常工作,html应该是这样的
div{border:1px solid#ff0000;高度:30px;}
.content-wrapper.row-fluid+.footer.row-fluid{
边缘顶端:40px;
}
.path frontpage.content-wrapper.row-fluid+.path frontpage.footer.row-fluid{
边际上限:0px;
}
包装纸
页脚