开发者

Css :not style outside element

I want to change the font and bold the <strong> elements that are outside of div.main2, but leave elements inside div.main2 unaffected.

I tried usin开发者_开发知识库g :not(.main2) and strong *:not(.main2) but the logic seemed wrong.

The idea is to get something like :

TITULO TITULO

TITULO TITULO

You can check the example here in order to work it out.


UPDATE:

For example in this jsFiddle

Titulo Titulo

Titulo Titulo

Titulo Titulo

Should be like :

Titulo Titulo

Titulo Titulo

Titulo Titulo

in the future can had tables , other divs wit other things...


The easiest way to do it is use two rules instead:

.main strong {
    font-family: Verdana;
    font-weight: bold;
}

.main2 strong {
    font-family: inherit;
    font-weight: inherit;
}

jsFiddle


If you're really looking for a CSS3 solution, you can use this:

.main :not(.main2) strong, .main > strong {
    font-family: Verdana;
    font-weight: bold;
}

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜