相关疑难解决方法(0)

为什么我的jQuery:not()选择器不在CSS中工作?

我有这个布局:

<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)

css jquery css-selectors css3 jquery-selectors

57
推荐指数
1
解决办法
1万
查看次数

CSS:not()选择器指定前一个元素

这是一个非常简单的问题,我无法理解.

我有一系列像这样的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)

但这似乎不起作用.我是在做某种愚蠢的语法错误还是这样做不可能?

css css-selectors css3

1
推荐指数
1
解决办法
155
查看次数

标签 统计

css ×2

css-selectors ×2

css3 ×2

jquery ×1

jquery-selectors ×1