我有这个布局:
<div id="sectors">
<h1>Sectors</h1>
<div id="s7-1103" class="alpha"></div>
<div id="s8-1104" class="alpha"></div>
<div id="s1-7605" class="beta"></div>
<div id="s0-7479"></div>
<div id="s2-6528" class="gamma"></div>
<div id="s0-4444"></div>
</div>
Run Code Online (Sandbox Code Playgroud)
使用这些CSS规则:
#sectors {
width: 584px;
background-color: #ffd;
margin: 1.5em;
border: 4px dashed #000;
padding: 16px;
overflow: auto;
}
#sectors > h1 {
font-size: 2em;
font-weight: bold;
text-align: center;
}
#sectors > div {
float: left;
position: relative;
width: 180px;
height: 240px;
margin: 16px 0 0 16px;
border-style: solid;
border-width: 2px;
}
#sectors > div::after {
display: block;
position: absolute; …
Run Code Online (Sandbox Code Playgroud) 这是一个非常简单的问题,我无法理解.
我有一系列像这样的div:
<h1>Heading 1</h1>
<h2>Heading 2</h2>
<p>Paragraph text</p>
<h2>Heading 3</h2>
<p>Paragraph text</p>
Run Code Online (Sandbox Code Playgroud)
在CSS中我可以使用以下命令来定位h1标签后面的h2标签:h1+h2{}
但是我似乎无法:not()
以这种方式使用.例如,我想使用:
#text h2:not(h1+h2){
margin-top:3em;
}
Run Code Online (Sandbox Code Playgroud)
但这似乎不起作用.我是在做某种愚蠢的语法错误还是这样做不可能?