Question

Well it should work in IE, I know IE doesnt support content property anything other that?

Was it helpful?

Solution

The only option is the the content property:

The content property is used with the :before and :after pseudo-elements, to insert generated content.

But as you point out, this is part of CSS 3 and is not supported by IE. In the meantime you will need to compensate by using JavaScript.

OTHER TIPS

It is quite possible to solve this without Javascript, using a combination of HTML and CSS. The trick is to duplicate the content added by the CSS in the HTML an IE-specific conditional comment (not shown by other browsers) and use the display CSS selector to toggle when that element is shown. According to MSDN, IE 8+ supports CSS :after and content:, so only IE 7 and below need to use a conditional comment.

Here is an example:

<style type="test/css" media="screen">
.printonly { display: inline; }
</style>

<style type="text/css" media="print">
#maintitle:after { content:" \2014  Site Title";} /* for IE8+ and Other Browsers. sidenote: Can't use &mdash directly in generated content, so using escape code */
.printonly { display:inline } /* For IE <= 7 */
</style>

<h1 id="maintitle">Page Title 
    <!--[if lte IE 7]><span class="printonly">&mdash; Site Title</span><![endif]-->
</h1>

Short of pictures of text — no.

You could try using IE8.js to fix content, which might do the trick. If not, then there's nothing you can do besides background-image's with text

The only way is JavaScript, or CSS3.

Maybe you could tell us what you need to do - then we can help.

Why can't you do it with js?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top