pseudo-class

Relationship between active and focused states [duplicate]

寵の児 提交于 2019-12-11 16:08:26
问题 This question already has answers here : What is the difference between :focus and :active? (7 answers) Closed last year . Currently I'm trying to understand how :active and :focus pseudo-classes related with each other. Here is my example: <a href="http://google.com" target="_blank">Google</a> <style> a:link { color: rgb(0, 138, 206); } /* Blue */ a:visited { color: rgb(180, 14, 180); } /* Violet */ a:active { color: yellow; } a:focus { color: green; } </style> If you click on the link, you

How to set a dynamically generated pseudoclass name in JavaScript to work with the instanceof operator?

好久不见. 提交于 2019-12-11 03:38:34
问题 I'd like to set the name of a JavaScript pseudoclass stored in an array with a specific name, for example, the non-array version works flawlessly: var Working = new Array(); Working = new Function('arg', 'this.Arg = arg;'); Working.prototype.constructor = Working; var instw = new Working('test'); document.write(instw.Arg); document.write('<BR />'); document.write((instw instanceof Working).toString()); Output: test true However this format does not function: // desired name of pseudoclass var

How do I use pseudo-classes to select all children except first and last?

南楼画角 提交于 2019-12-11 02:45:15
问题 In CSS, for the example shown below, how can I make it such that the styles get applied to all paragraphs, except for the first and the last paragraph? <div class="entry"> <p>...</p> <p>...</p> <p>...</p> <p>...</p> <p>...</p> </div> I've tried the following to exclude the first paragraph, but that doesn't work: div.entry p:nth-child(n+1) { /* ... */ } I've also tried nth-of-type() and not() , but couldn't get them to work the way I thought they would. Edit: I've decided to wrap all the <p> s

What is the default way an iOS device handles the :hover pseudo-class?

爷,独闯天下 提交于 2019-12-11 00:48:44
问题 I have a div that can be clicked (via jQuery $('.mydiv').click ) - this expands the div, a second click collapses it. The same div has some CSS :hover rules applied to it (i.e. to show more info on hover) - this works as intended on a PC. When using an iOS device, the click works, AND also applies the :hover pseudo-class - so my extra info shows up. This is pretty much exactly what I wanted to happen (amazingly). However, just having something with a :hover pseudo-class in the CSS does not

Pseudo-class on pseudo-element

风流意气都作罢 提交于 2019-12-10 19:57:23
问题 OK to be clear, I am not trying to make the (pseudo)inception for css. Just wanted to check if it's possible to add a pseudo class on a pseudo element. For eg: .some-class:after:hover { } doesnt seem to work. This works though: .some-class:hover:after { } And ofcourse, this doesn't: .some-class:hover:after:hover { } What I am trying to do is- there is a div. If you hover on that div, I am attaching a delete icon using :after on the div. I want to style this icon (say, have it zoom to 1.1 or

Selector for when only one child exists in parent

北城以北 提交于 2019-12-10 14:56:49
问题 I'm playing around with CSS selectors and i'm wondering can i build a custom css selector to only work when there only one of class .widget-button , example code; <div class='container a'> <div class='widget-a' /> <div class='widget-b' /> <div class='widget-button' /> <div class='widget-b' /> </div> So you would assume theres' a combination of pseudo selectors ( :only-child ? ) to this job that will work for the above? Hoever the bellow example should no selections/styles applyied as there

Simple css :before:hover not working? CSSlint no errors?

元气小坏坏 提交于 2019-12-10 14:34:16
问题 http://jsfiddle.net/nicktheandroid/k93ZK/2/ This should be really simple, I just don't understand why it's not working. When hovering over the :before it should change it's opacity to 1, but it doesn't. Why? p { padding-top:15px; position:relative; } p:before { display:block; width:55px; height:55px; content: 'hello'; background:#fff; padding:5px 10px; position:absolute; right:0; opacity:.5; -webkit-transition: all 0.3s ease-in-out; } p:before:hover { opacity:1; bakcground:#000; } EDIT: I'm

How to access the focus/hover/visited CSS properties of an element through Javascript?

六月ゝ 毕业季﹏ 提交于 2019-12-10 11:56:57
问题 I may be tired and thinking oddly right now, but I simply cannot find how to retrieve the values of CSS properties defined in an element's focused, hovered or visited states. The goal is to use the values in Javascript. Important : I do not need to get the focused/hovered/visited elements . I want to access certain values of any element in the DOM with CSS properties defined for the following states : :focus , :hover and :visited . These pseudo-classes do not seem to help in this case, so do

Select currently focused element

泪湿孤枕 提交于 2019-12-10 09:24:15
问题 I'd like to find the currently focused element in the whole document. I tried using the :focus pseudoclass introduced with jQuery 1.6: $(document).find(":focus") But $(document).find(":focus").length always returns 0 回答1: You should be able to use the activeElement property of the document : var focus = $(document.activeElement); If you look at the jQuery documentation for :focus it makes this perfectly clear: If you are looking for the currently focused element, $( document.activeElement )

CSS Pseudo-classes with jQuery

佐手、 提交于 2019-12-09 01:21:33
问题 I've just learnt a bit jQuery, and am trying to use it for a simple color-changing effect. Let's say I have two <div >s, #foo and #bar. #foo has a lot of URLs, and has the following CSS defined: #foo a {color: blue; border-bottom: 1px dashed blue} #foo a:hover {color: black; border-bottom: 1px solid black} now I would like to change the color of the links (a:link) in #foo when the user clicks #bar, but keep the a:hover color untouched, so I write my function like this: //... $("#bar").click