pseudo-element

Is it ok to use multiple pseudo-elements in css?

大城市里の小女人 提交于 2019-12-04 22:42:23
I want to make a menu where each item is separated with a ·. To achieve this I use menu li:before { content: "· "; } This is swell, but it generates a dot before the first item as well. Therefore, i would like to use :first-child pseudo-class as well. Can I do this? Sure you can - http://jsfiddle.net/WQBxk/ p:before { content: "BEFORE "; display: block; } p:first-child:before { content: "1ST"; display: block } ​ The bad - it won't work in IE7 and below. Not because of the multiple pseudo selectors, but because of non-supported :before - http://kimblim.dk/css-tests/selectors/ Just tested in IE8

Why does IE10 require the presence of a p:hover {} rule for transitions to work on a pseudo element?

青春壹個敷衍的年華 提交于 2019-12-04 18:23:28
问题 HTML: <p>Hover</p> CSS: p::after { content: " here"; transition: all 1s; } p:hover::after { font-size: 200%; color: red; } Live demo: http://jsfiddle.net/SPHzj/13/ (works in Firefox and Chrome) As you can see, I've set up CSS transitions on the ::after pseudo-element of the paragraph. Then, when the paragraph is hovered, two new styles apply for the pseudo-element which are transitioned. This works in Firefox and Chrome, but not in IE10. My reasoning was that IE doesn't understand the p:hover

Is it possible to select css generated content? [duplicate]

帅比萌擦擦* 提交于 2019-12-04 15:08:11
问题 This question already has answers here : How can I make generated content selectable? (2 answers) Closed 4 years ago . Let's say I have mark up: <div data-generated="world!">Hello </div> ..with CSS: div:after { content: attr(data-generated); } This produces the text: Hello world! - FIDDLE div:after { content: attr(data-generated); } <div data-generated="world!">Hello </div> BUT... If I try to select / Copy the text - only the 'hello ' part is selectable. Is there any way to select css

css apply styling to all elements except those in the last row

夙愿已清 提交于 2019-12-04 14:09:43
I have a product category page with 3 products per row. I want every row to have a border bottom except for the last row. This should have no border bottom. The last row may contain 1, 2, or 3 <li> elements. The current code that I'm using applies the border-bottom property to every 3rd <li> element, which is not quite what I want. CSS: .products li { width: 33.33333%; } .products li:nth-child(3n){ border-bottom: 1px rgba(51, 51, 51, 0.1) solid; } .products li:nth-child(2-PREVIOUS-SIBLING-ELEMENTS){ border-bottom: 1px rgba(51, 51, 51, 0.1) solid; } HTML: <ul class="products"> <li>Product</li>

When to use :before or :after

≡放荡痞女 提交于 2019-12-04 14:09:19
Before moving to my question, I know how the :before and :after selectors work. (not a duplicate of what is ::before or ::after expression ). My question is in regards to use. I've seen some inconsistencies over the years where these selectors have been used to display the same thing. Same results, different approach. In some specific cases, such as adding a font awesome icon within an li before the a the :before selector makes sense. I'm not inquiring about that use, since it's intuitive enough to understand. But take a speech bubble for a tooltip for instance. I have seen the triangle placed

Why was ::selection removed from the CSS Selectors spec, and how does its specificity work against type selectors?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-04 10:31:15
问题 Some questions about using CSS to specify the color of selected text: https://developer.mozilla.org/En/CSS/::selection says that, ::selection was drafted for CSS3 Selectors but removed from the current CSS3 draft. Anyhow, it's implemented in browsers and support will continue. Why was it removed? Imagine that a rule like the following exists in the default CSS that's implemented by the browser: ::selection { background-color: Highlight; color: HighlightText; } Further imagine that a rule like

Selection changes color when Firefox loses focus

戏子无情 提交于 2019-12-04 09:19:53
I'm setting the selection background color via CSS: ::selection { background:#cc0000; color:#fff; } ::-moz-selection { background:#cc0000; color:#fff; } On most browsers when the focus is somewhere else (like an IFrame), the selection color will stay the same, e.g.: but on Firefox it won't: You can see this in action on jsFiddle here . How can I get Firefox to set the selection color in this case? Is this a bug? How can I get Firefox to set the selection color in this case? Unfortunately, there doesn't appear to be a way to do so. Is this a bug? Nobody (including Mozilla themselves?) can say

CSS : Styling the content of before pseudo element on a list

拜拜、爱过 提交于 2019-12-04 08:39:06
问题 I'm trying to style an ordered list (no dot, a border with radius and rotate 45°) <div class="test"> <ol> <li><span>it's a test</span></li> <li><span>and again</span></li> </ol> </div> And the css .test ol { counter-reset: li; list-style-type: none; } .test ol > li { position:relative; list-style:none; } .test ol > li:before { content:counter(li); counter-increment:li; position:absolute; top:-2px; left:-24px; width:21px; color:#E2202D; font-weight:bold; font-family:"Helvetica Neue", Arial,

Image overlay using :after pseudo-element

耗尽温柔 提交于 2019-12-04 06:07:35
I'm trying to overlay a transparent image over another via the after property. It's not even showing up using this method. I wanna use a base64 encoded image if at all possible. I tried with a regular non-encoded image too. No dice. Anyone have any thoughts? My HTML: <div class="image-container"> <img src="images/sample.jpg" alt="Sample Image" /> </div> My CSS: .image-container { position: relative; width: 183px; height: 137px; overflow: hidden; } .image-container img { position: absolute; } .image-container img:after { display: block; position: absolute; margin-top: -50%; width: 183px; height

What is it in a pseudo-element that makes the pseudo-element pseudo?

此生再无相见时 提交于 2019-12-04 05:26:42
问题 In my other question What does "pseudo" mean in CSS? I got this answer: "A pseudo-element is something that acts like an element, but is not an element". What is it that makes pseudo-element not an element? 回答1: A pseudo element is not in the dom. That is what makes it not an element. It is an element created by CSS. Pseudo elements cannot be seen or manipulated by various technologies. For example, many JavaScript methods don't work for pseudo elements. That is why it is "not an element." To