All Questions

721
votes
18answers
441489 views

Selecting and manipulating CSS pseudo-elements such as ::before and ::after using jQuery

Is there any way to select/manipulate CSS pseudo-elements such as ::before and ::after (and the old version with one semi-colon) using jQuery? For example, my stylesheet has the following rule: .spa...
490
votes
19answers
313091 views

Can I use a :before or :after pseudo-element on an input field?

I am trying to use the :after CSS pseudo-element on an input field, but it does not work. If I use it with a span, it works OK. <style type="text/css"> .mystyle:after {content:url(smiley.gif);...
52
votes
2answers
3744 views

Why isn't it possible to combine vendor-specific pseudo-elements/classes into one rule set?

In CSS it is possible to style placeholder text within an input using a combination of vendor-specific pseudo-classes and pseudo-elements (to get the best cross-browser coverage). These all share the...
254
votes
6answers
268710 views

How to write :hover condition for a:before and a:after?

How to write :hover and :visited condition for a:before? I'm trying a:before:hover but it's not working
87
votes
2answers
53534 views

CSS :after not adding content to certain elements

I'm having trouble understanding the behavior of the CSS :after property. According to the spec (here and here): As their names indicate, the :before and :after pseudo-elements specify the locatio...
56
votes
7answers
90307 views

:after and :before css pseudo elements hack for IE 7

I am using :after and :before css pseudo elements and it is working fine in IE8, and all modern browsers but it is not working fine in IE7. Are there known hacks to work around this in IE7?
183
votes
6answers
132908 views

Is it possible to set the stacking order of pseudo-elements below their parent element?

I am trying to style a element with the ::after pseudo element CSS selector #element { position: relative; z-index: 1; } #element::after { position:relative; z-index: 0; content:...
14
votes
4answers
4136 views

Why do the :before and :after pseudo-elements require a 'content' property?

Given the following scenario, why does the :after selector require a content property to function? .test { width: 20px; height: 20px; background: blue; position:relative; } ...
9
votes
4answers
2732 views

Elongated hexagon shaped button using only one element

I would like to make a button like these one just with CSS without using another element. Button Image Since the button has a border attached, I think I normally need both, the :before and :after ...
87
votes
3answers
53600 views

Why don't :before and :after pseudo elements work with `img` elements?

I am trying to use a :before pseudo element with an img element. Consider this HTML and CSS... HTML <img src="http://0.gravatar.com/avatar/this-is-not-a-hash" alt="" /> CSS img:before { ...

Previous Next