css-content

How can I get IE8 to accept a CSS :before tag?

﹥>﹥吖頭↗ 提交于 2019-11-27 14:56:48
问题 I have the following CSS code .editable:before { content: url(../images/icons/icon1.png); padding-right:5px; } this is used in conjunction with the following markup: <span class="editable"></span> In every other blessed browser in the world my icon is appearing, but IE8 seems to have a problem with this. Isn't the :before pseudo-element CSS2? isn't content: also a CSS2 command? what gives? 回答1: Update: I misread the page! IE 8 does support :before with images, it just doesn't when it is in

CSS Pseudo Element Counters: can you increment an alphabet letter “a”, “b”, “c”, etc instead of a number?

馋奶兔 提交于 2019-11-27 13:08:30
As defined here: http://www.w3.org/TR/CSS21/generate.html#propdef-counter-increment You can use code like the following to increment numbers in pseudo elements. H1:before { content: "Chapter " counter(chapter) ". "; counter-increment: chapter; /* Add 1 to chapter */ } H1 { counter-reset: section; /* Set section to 0 */ } H2:before { content: counter(chapter) "." counter(section) " "; counter-increment: section; } Is there a way you can use the same code to increment letters like "a", "b", "c", etc? Thank you! Yes, the second argument to counter() defines the type of counter used, as for the

CSS:after encoding characters in content

梦想与她 提交于 2019-11-27 11:27:12
问题 I am using the following CSS, which seems to be working: a.up:after{content: " ↓";} a.down:after{content: " ↑";} The characters however cannot seem to be encoded like this, as the output is literal and shows the actual string: a.up:after{content: " ↓";} a.down:after{content: " ↑";} If I can't encode it, it feels like I should use something such as .append() in jQuery, as that supports the encoding. Any ideas? 回答1: To use encoded Unicode characters in content you need to provide either the

CSS data attribute new line character & pseudo-element content value

岁酱吖の 提交于 2019-11-27 03:55:50
Is it possible to have a new line in a data attribute ? I am trying to do something like this: CSS: [data-foo]:after { content: attr(data-foo); background-color: black; } HTML <div data-foo="First line \a Second Line">foo</div> I found that "\a" is a new line in CSS, but still does not work for me. Here is how this can work. You need to modify your data attribute as follows: <div data-foo='First line Second Line'>foo</div> and the CSS (proof of concept): [data-foo]:after { content: attr(data-foo); background-color: black; color: white; white-space: pre; display: inline-block; } Fiddle Demo:

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

…衆ロ難τιáo~ 提交于 2019-11-26 18:51:14
Is it possible to have multiple :before pseudos for the same element? .circle:before { content: "\25CF"; font-size: 19px; } .now:before{ content: "Now"; font-size: 19px; color: black; } I am trying to apply the above styles to the same element using jQuery, but only the most recent one is applied, never both of them. BoltClock In CSS2.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.) As a result, when you have multiple :before rules

after pseudo element not appearing in code [duplicate]

一曲冷凌霜 提交于 2019-11-26 18:32:43
问题 This question already has answers here : Why do the :before and :after pseudo-elements require a 'content' property? (4 answers) Closed 3 years ago . I'm trying to use the after pseudo element to add some effects to a site. <div class="product-show style-show"> <ul> <li> .... <div class="..."> <div class="readMore less">...</div> <a href="3" class="readMoreLink" onclick="return false;">Read More</a> </div> .... </li> </ul> </div> And stylesheets: .product-show .readMore.less { max-height:

CSS Pseudo Element Counters: can you increment an alphabet letter “a”, “b”, “c”, etc instead of a number?

ε祈祈猫儿з 提交于 2019-11-26 18:11:18
问题 As defined here: http://www.w3.org/TR/CSS21/generate.html#propdef-counter-increment You can use code like the following to increment numbers in pseudo elements. H1:before { content: "Chapter " counter(chapter) ". "; counter-increment: chapter; /* Add 1 to chapter */ } H1 { counter-reset: section; /* Set section to 0 */ } H2:before { content: counter(chapter) "." counter(section) " "; counter-increment: section; } Is there a way you can use the same code to increment letters like "a", "b", "c"

Can you apply a width to a :before/:after pseudo-element (content:url(image))?

泄露秘密 提交于 2019-11-26 14:45:11
问题 This is in addition to my recent question: Is it possible to use pseudo-elements to make containing elements wrap around an absolutely-positioned element (like a clearfix)? JSFiddle: http://jsfiddle.net/derekmx271/T7A7M/ I'm trying to use pseudo-elements to "clearfix" absolutely positioned images. I have gotten as far as getting the same image to display behind the slides, but cannot seem to apply widths to the inserted image. Am I crazy, or can you NOT apply widths to pseudo elements whose

Css Content, Attr and Url in the same sentence

断了今生、忘了曾经 提交于 2019-11-26 11:36:08
问题 I have used the content attribute for a long time, and today I wanted to try something new. Instead of using JS to display a image tooltip I wanted to know if it was possible to do it dynamically with CSS. So I tried: .TableLine:hover:after{ content: url(\"../Img/Photo/\"attr(id)\".jpg\"); } where attr(id) is supposed to return the ID of the picture (alphanumeric) which is also the name of the picture. It doesn\'t work at all, it has no effect. I think that the block did not parse because

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

落花浮王杯 提交于 2019-11-26 05:31:48
问题 Is it possible to have multiple :before pseudos for the same element? .circle:before { content: \"\\25CF\"; font-size: 19px; } .now:before{ content: \"Now\"; font-size: 19px; color: black; } I am trying to apply the above styles to the same element using jQuery, but only the most recent one is applied, never both of them. 回答1: In CSS2.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 —