Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable -webkit-animation/transition-property for :before and :after pseudo elements?

How to enable -webkit-animation for :before and :after pseudo elements?

You can see in http://jsfiddle.net/4rnsx/ that it is not working for :before and :after.
And here I am trying to enable this feature with Mootools http://jsfiddle.net/6bzCS/.


Mozilla - will support it in Firefox 4 https://developer.mozilla.org/en/CSS/-moz-transition-property
W3C - CSS3 supports transition-property for all elements, :before and :after pseudo elements http://www.w3.org/TR/css3-transitions/#transition-property


Update: How to enable fadein,fadeout for CSS3 tooltip http://css-plus.com/2010/04/create-a-speech-bubble-tooltip-using-css3-and-jquery/ and demo?

like image 626
Binyamin Avatar asked Oct 04 '10 12:10

Binyamin


People also ask

What do the pseudo selectors before and after allow you to do?

A CSS pseudo-element is used to style specified parts of an element. For example, it can be used to: Style the first letter, or line, of an element. Insert content before, or after, the content of an element.

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

The input element has no content in the CSS view, and so has no :before or :after pseudo content. This is true of many other void or replaced elements.

What are before and after pseudo elements in CSS?

CSS ::before and ::after pseudo-elements allow you to insert “content” before and after any non-replaced element (e.g. they work on a <div> but not an <input> ). This effectively allows you to show something on a web page that might not be present in the HTML content.

Can I have multiple before pseudo elements for the same element?

1, an element can only have at most one of any kind of pseudo-element at any time. (This means an element can have both a :before and an :after pseudo-element — it just cannot have more than one of each kind.)


2 Answers

The jsFiddle mentioned in the question appears fine in modern Chrome and Safari browsers. I think the animation side of thing's been solved by browser evolution.

However, there's still an outstanding/open bug for the transition side of things: http://code.google.com/p/chromium/issues/detail?id=54699

like image 163
searlea Avatar answered Nov 16 '22 01:11

searlea


The bug is fixed in Google Chrome 24 on January 3rd, 2013.

Waiting for Safari to pull these updates.

See how things are doing with other browsers here

like image 31
Dan Avatar answered Nov 16 '22 02:11

Dan