pseudo-class

Why is a pseudo-class so called?

杀马特。学长 韩版系。学妹 提交于 2019-11-27 06:54:17
问题 a:hover Why is it called a "pseudo-class"? Are there any similarities with the concept of "class"? 回答1: In CSS terms, a class is a selector that starts with a full stop, e.g. .foo { ... } It would be used in the form <div class="foo"> This use of "class" is more in the sense "a set or category of things having a common characteristic and differentiated from others by kind or quality", rather than borrowing from OO terminology. A pseudo class is "not quite a real one" as the user agent defines

Placeholder CSS not being applied in IE 11

空扰寡人 提交于 2019-11-27 05:42:46
问题 I am getting some problem in applying placeholder css. I am trying to apply css (i.e. color:#898F9C; ) on input-box placeholder using pseudo-class selector :-ms-input-placeholder, but it's not working in IE. Demo After some hit and try, I get solution of my problem, but it's amazing. If i removed the default css/style color on input-box, placeholder css working properly in IE(It's amazing behavior of Internet Explorer). My default css/style: #search { color:blue; } Working-fiddle without

Why doesn't this CSS :not() declaration filter down?

*爱你&永不变心* 提交于 2019-11-27 05:37:17
I want to select spans that are not the descendants of a specific class, let's call it "no". Here's my CSS: div:not(.no) span{background-color:#00f;} Here's the HTML <div> <span>yes 1</span> </div> <div class="no"> <span>no 1</span> </div> <div class="no"> <div> <span>no 2</span> </div> </div> Two questions: Why does my CSS apply to both yes 1 and no 2? Why does the whole thing break if I switch to a universal selector? *:not(.no) span{background-color:#00f;} Here's the code in JSFiddle: http://jsfiddle.net/stephaniehobson/JtNZm/ Both of the span elements' parent div elements don't have the

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

房东的猫 提交于 2019-11-27 04:20:03
I'm trying to style a disabled input. I can use: .myInput[disabled] { } or .myInput:disabled { } Is the attribute selector the modern CSS3 way and the way to go forward? I used to use the pseudo-class, but I can't find any info on whether they are the old way and won't be supported or whether they're both equal and you can use whatever you like best. I have no need to support older browsers (it's an intranet application), so is it: attribute is newer and better pseudo-class is still the way to go whichever you like best there's a technical reason to use one over the other Is the attribute

What's the difference between CSS3's :root pseudo class and html?

不羁的心 提交于 2019-11-27 02:07:39
问题 I can't seem to find much information about this. Smashing Magazine seems to be saying that html and :root are the same thing but surely there must be a tiny difference? 回答1: From the W3C wiki: The :root pseudo-class represents an element that is the root of the document. In HTML, this is always the HTML element. CSS is a general purpose styling language. It can be used with other document types, not only with HTML, it can be used with SVG for example. From the specification (emphasis mine):

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

假如想象 提交于 2019-11-27 01:43:30
The CSS language pseudo-class to allow us specify different styles for different languages, like so: html:lang(en) .foo { ... } However, this doesn't work in IE7, so I've been using an attribute selector: html[lang="en"] .foo { ... } They seem to do the same thing, but are there any subtle differences? And if not, why does CSS even have a language pseudo-class, when the attribute selector does the exact same thing? 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

Is it possible to force ignore the :hover pseudoclass for iPhone/iPad users?

[亡魂溺海] 提交于 2019-11-26 23:50:04
问题 I have some css menus on my site that expand with :hover (without js) This works in a semi-broken way on iDevices, for example a tap will activate the :hover rule and expand the menu, but then tapping elsewhere doesn't remove the :hover . Also if there is a link inside the element that is :hover 'ed, you have to tap twice to activate the link (first tap triggers :hover , second tap triggers link). I've been able to make things work nicely on iphone by binding the touchstart event. The problem

heading with horizontal line on either side [duplicate]

徘徊边缘 提交于 2019-11-26 20:01:51
This question already has an answer here: Line before and after title over image [duplicate] 2 answers I am working on some CSS where the design calls for page titles (headings) to be centered with horizontal lines that are vertically centered on either side. Further, there is a background image on the page so the background of the title needs to be transparent. I have centered the title and I can use pseudo class to create the line. But I need the line disappear when it cross the text of the title. I considered using a background gradient that goes transparent where the words are, but since

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

怎甘沉沦 提交于 2019-11-26 19:58:25
How can I select a certain element in a list of elements? I have the following: <div class="myclass">my text1</div> <!-- some other code follows --> <div> <p>stuff</p> </div> <div> <p>more stuff</p> </div> <p> <span>Hello World</span> </p> <div class="myclass">my text2</div> <!-- some other code follows --> <div> <p>stuff</p> </div> <p> <span>Hello World</span> </p> <input type=""/> <div class="myclass">my text3</div> <!-- some other code follows --> <div> <p>stuff</p> </div> <footer>The end</footer> I have the CSS class div.myclass {doing things} that applies to all, obviously, but I also

How to make a hover effect for pseudo elements?

心已入冬 提交于 2019-11-26 19:23:40
问题 I have a this setup: <div id="button">Button</div> and this for CSS: #button { color: #fff; display: block; height: 25px; margin: 0 10px; padding: 10px; text-indent: 20px; width: 12%; } #button:before { background-color: blue; content: ""; display: block; height: 25px; width: 25px; } Is there a way to give the pseudo element a hover effect such as #button:before:hover {...} and is it also possible to get the pseudo element to hover in response to another element being hovered like so: #button