pseudo-class

CSS :focus not working

这一生的挚爱 提交于 2019-11-30 15:17:51
I tried using :focus CSS pseudo-class in my project. I want to change the color of the element where I click on it. Now when I click my element change color only where it is active and after mouse up it return to old color. After second click I want it back to old color. I'm using Chrome. Demo here .row { display: inline-block; border: 1px solid grey; height: 200px; width: 200px; line-height: 1em; background: grey; margin: 5px; opacity: 0.1; } .row:active, .row:focus { background: orange; } <div id="main" class="container"> <div class="row" id="row0"> </div> </div> If you want a real focus

Before and After pseudo classes used with styled-components

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-30 13:42:46
问题 What is the proper way to apply :before and :after pseudo classes to styled components? I know that you can use &:hover {} to apply the :hover pseudo class to a styled-component. Does this work for All pseudo elements like before and after? I have tried using the &:before and &:after strategy with some rather complex examples and i'm not sure if my attempts are not working because i've got something wrong with my example or it just doesn't work like that. Does someone have some insight on

CSS :not pseudo-class not working

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-30 09:22:21
问题 I am learning about the :not() pseudo class and it is not working as expected. I want to color all text red except for .mind . For some reason this is not preventing the .mind element from being red. :not(.mind) { color: red } <div class='parent'> <div class='child'>One</div> <div class='child'>Two</div> <div class='child'>Three</div> <div class='child'>One</div> <div class='child'>Two</div> <div class='child'>Three</div> <div class='child'>One</div> <div class='mind'>mind</div> <div class=

What's the :any-link pseudo-class for?

若如初见. 提交于 2019-11-30 08:45:22
I don't know if it's a part of any standard, but at least two major browsers have implemented it: :-webkit-any-link in Chrome :-moz-any-link in Firefox I can't find any documentation for it. I would like to know its purpose, browser support, and examples of usage. :any-link is a new pseudo-class proposed in Selectors level 4 , that matches all elements that would be matched by :link, :visited . From what I see, its main purpose is to simplify selectors that need to select any hyperlinks, since the naming of :link is misleading; it specifically means unvisited links only, rather than all

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

南笙酒味 提交于 2019-11-30 06:26:16
问题 Is there a pseudo-class in CSS to specify :not(:hover) Or is that the only way to specify an item that is not being hovered? I went through several CSS3 references, and I see no mention of a CSS pseudo-class to specify the opposite of :hover. 回答1: Yes, use :not(:hover) .child:not(:hover){ opacity: 0.3; } jsBin demo Another example; I think you want to: "when one is hovered, dim all other elements" . If my assumption is correct, and assuming all your selectors are inside the same parent:

How to show the first N elements of a block and hide the others in css?

假装没事ソ 提交于 2019-11-30 04:41:22
I am trying to hide the first 3 elements having the class .row inside the block .container . What I'm doing is hiding all the .row first, and then I am trying to display the first 3 .row by using .row:nth-child(-n+3) jsfiddle here: http://jsfiddle.net/z8fMr/1/ I have two problems here: Row 3 is not displayed, am I using nth-child in the wrong way? Is there a better practice than hiding everything and then creating a specific rule to display the n first elements that I want? Is there a way in css to just display the first 3 .row and then hide all the other .row ? Thanks. You have a .notarow as

CSS3 :unchecked pseudo-class

天涯浪子 提交于 2019-11-30 00:12:08
I know there is an official CSS3 :checked pseudo-class, but is there an :unchecked pseudo-class, and do they have the same browser support? Sitepoint's reference doesn't mention one, however this whatwg spec (whatever that is) does. I know the same result can be achieved when the :checked and :not() pseudo-classes are combined, but i'm still curious: input[type="checkbox"]:not(:checked) { /* styles */ } Edit: The w3c recommends the same technique An unchecked checkbox can be selected by using the negation pseudo-class: :not(:checked) :unchecked is not defined in the Selectors or CSS UI level 3

a vs a:link, What is the difference?

五迷三道 提交于 2019-11-29 20:48:40
What is the differences between a {...} and a:link{...} ? Are there different usages, and benefits between them? According to W3C a:link is for not visited, a:visited is for visited, and just a applies to both. a covers all the bases. a:link is used only if the link in un- visited , un- hover ed, and in- active . So, use a for things like font-family (if you want links to come up in a different font), then use link for the standard formatting, and visited , hover and active for 'special effects'. EDIT: After reading Sander's W3C link , I can see that I didn't have it quite right. a:link will

Css pseudo classes input:not(disabled)not:[type=“submit”]:focus

[亡魂溺海] 提交于 2019-11-29 20:21:23
I want to apply some css for inputs elements and I want to do that only for inputs that are not disabled and are not submit type, below css is not working, maybe if someone can explain me how this must be added . input:not(disabled)not:[type="submit"]:focus{ box-shadow:0 0 2px 0 #0066FF; -webkit-box-shadow:0 0 4px 0 #66A3FF; } Instead of: input:not(disabled)not:[type="submit"]:focus {} Use: input:not([disabled]):not([type="submit"]):focus {} disabled is an attribute so it needs the brackets, and you seem to have mixed up/missing colons and parentheses on the :not() selector. Demo: http:/

Clearing off :target CSS psuedo class

不想你离开。 提交于 2019-11-29 17:08:24
Lately I've been working on Shower HTML5+CSS3 presentation template to make a upcoming presentation. Shower uses the CSS :target pseudo-class which makes it easy to identify the current slide in the overview of the slides. I understand how :target works through the hash in the URL, but however I cannot get it to clear the :target CSS from all elements at all. So my question is: given that after an element has been :target ed, how can we clear all the :target and revert it to the norm using JavaScript? The use of History API doesn't seem to work. I previously tried the following two statements