I'm using CSS content generation to add nice quotes to my title, like this: “My Title” Notice they are skewed and so I can't use "open-quote" and "close-quote" since those are straight. This is the specific code: Code: .frontlist_item .content h1:before { content: "“" } .frontlist_item .content h1:after { content: "”" } As you can see I'm using HTML-encoded characters for this, but apparantly that's not allowed in CSS, since now my titles look like this: “My Title” The html-encoding just ain't translated. I tried just putting the character straight in there (like content: "”"), and this worked locally, but when I put the code on my server, weird characters appear in the browser, instead of the quotes. If someone can help me out with this it'd be greatly appreciated.
It should be allowed... perhaps you haven't defined your doctype or something of that nature? I convert all of my database output to use the html-encoded characters by htmlentities($data, ENT_QUOTES), and it outputs just that type of thing.
Is content: supported by all browsers? I heared that it did bad things to older versions of ie and opera...
Firehed: I'm including the stylesheet with <link rel="stylesheet" type="text/css" href="main.css" /> and have no headers in the css file (don't think there are any anyway?). The doctype I'm using (generated by Bluefish): <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/xhtml1-strict.dtd"> Will: It worked for me under Safari, Shiira, Opera 8, 9, IE 6, Firefox Wouldn't surprise me if it didn't work for IE 5, but that's allright, it's not that those quotes will make a life's differince... Also, if I include “ directly in the html, it does work.
Fixed! I had to use the "CSS-style" encoding, and these are apparntly: \201C for left double quotes, and \201D for right double quotes. Thanks for your help all!
Good to know! Thanks for posting your solution here, too many people just say "I figured it out" without posting what made it work. So IE6+ even understands these? Cool! Are they part of the W3C standard for CSS 2?
I thought it did work with IE6 but I'm not sure. Yes, they are very much a part of the W3C standard for CSS 2. Other great things one can do with content generation is using counters, for example to colour even rows in a table differintly than uneven ones. Definetly worth checking out, it helps even seperate content from design even more, which is always A Good Thing (tm)
I'm pretty much 100% certain that IE supports neither content or the :before selector. Have you tested it?
I'd wager a guess that it didn't work (with standard codes) because you used XHTML strict instead of the more often-used transitional. Just a guess though, seeing as I'm well overdue for some sleep now. Stupid cool white lightbulbs make you forget it's night since it's not all yellow and artifical-looking