How to set content of a div using CSS


I'm working on customizing my new blog, and part of that is adding some image content above the link section. I can do that directly be editing the theme.master file (I'm using community server), but I'd like to be able to do it through the CS dashboard.


I've put in a div named EricBlogPictureLinks, but I can't figure out how to set the innerText property through CSS. Is it possible?


Comments (6)

  1. This is about the closest thing I can think of to generating actual content from CSS:

    http://www.w3schools.com/css/pr_gen_content.asp

    Cheers,

    Matt

  2. Kevin Daly says:

    Wouldn’t setting content from CSS violate the idea of using CSS in the first place?…if you’re using CSS to set content, that’s not really separating content from layout and so on.

  3. Haacked says:

    The CSS "content" attribute doesn’t work in IE, so I’d rule it out. Better off sticking with some javascript.

  4. RichB says:

    The CSS content property is what you want. Unfortunately, some browsers that saw no development between 2001 and 2005 don’t support it.

    Alternatively, you could attach a dhtml behavior (IE-proprietary) using CSS and this would point to Javascript in an external file which could do the content injection for you. I imagine XBL in Firefox works the same way, but I have less experience with XBL than HTC.

    It all depends on the audience "reach" you want to achieve for your website.

  5. I don’t think it’s possible. However, you can set a background image, so if you’re doing images for headings, that’s certainly doable.

  6. Jeff Lynch says:

    Here’s an example:

    #wrapper-menu-top {

    background: white url(‘images/bg02-white-left.png’) no-repeat left top;

    }

Skip to main content