Is there an opposite CSS pseudo-class to :hover?

Yes, use :not(:hover) .child:not(:hover){ opacity: 0.3; } .child { display: inline-block; background: #000; border: 1px solid #fff; width: 50px; height: 50px; transition: 0.4s; } .child:not(:hover) { opacity: 0.3; } <div class=”parent”> <div class=”child”></div> <div class=”child”></div> <div class=”child”></div> <div class=”child”></div> <div class=”child”></div> </div> Another example; I think you want to: “when one is hovered, dim all … Read more

What’s the difference between html[lang=”en”] and html:lang(en) in CSS?

In HTML, both the :lang() pseudo-class and the attribute selector will match an element with the corresponding lang attribute. The difference is that a browser may have other ways of determining the language of a given element when testing against the :lang() pseudo-class which may be defined by the document language and/or the implementation, whereas … Read more

Should I use CSS :disabled pseudo-class or [disabled] attribute selector or is it a matter of opinion?

Is the attribute selector the modern CSS3 way and the way to go forward? attribute is newer and better No; actually, attribute selectors have been around since CSS2, and the disabled attribute itself has existed since HTML 4. As far as I know, the :disabled pseudo-class was introduced in Selectors 3, which makes the pseudo-class … Read more

heading with horizontal line on either side [duplicate]

Look at this http://blog.goetter.fr/post/36084887039/tes-pas-cap-premiere-edition , here is your answer. Here is your original code modified h1 { position: relative; font-size: 30px; z-index: 1; overflow: hidden; text-align: center; } h1:before, h1:after { position: absolute; top: 51%; overflow: hidden; width: 50%; height: 1px; content: ‘\a0’; background-color: red; } h1:before { margin-left: -50%; text-align: right; } .color { … Read more

How to select the first, second, or third element with a given class name?

use nth-child(item number) EX <div class=”parent_class”> <div class=”myclass”>my text1</div> some other code+containers… <div class=”myclass”>my text2</div> some other code+containers… <div class=”myclass”>my text3</div> some other code+containers… </div> .parent_class:nth-child(1) { }; .parent_class:nth-child(2) { }; .parent_class:nth-child(3) { }; OR :nth-of-type(item number) same your code .myclass:nth-of-type(1) { }; .myclass:nth-of-type(2) { }; .myclass:nth-of-type(3) { };

How to make a hover effect for pseudo elements?

You can change the pseudo-element based on hover of the parent: JSFiddle DEMO #button:before { background-color: blue; content: “”; display: block; height: 25px; width: 25px; } #button:hover:before { background-color: red; } #button { display: block; height: 25px; margin: 0 10px; padding: 10px; text-indent: 20px; width: 12%;} #button:before { background-color: blue; content: “”; display: block; height: … Read more