Log in

View Full Version : *:lang(fr) HTML/CSS problem?



Mike BWD
03-26-2008, 06:36 PM
Hi I am using the following code:
HTML- my editor generates:
<p>The German word for cat is <em xml:lang="de" >Katze</em></p>
but I cant seem to get a style to work on this.
This code works fine:
<p>The French word for cat is <em lang="fr">chat</em></p>

CSS I am using:
*:lang(fr) { background-image:url(../css/flag/fr.gif);}
*:lang(de) { background-image:url(../css/flag/gr.gif);}

Questions:
1. Is the XHTML correct/incorrect?
http://www.websitedev.de/css/validator-faq - says:
Your XHTML/XML document is not well-formed; it probably includes directly adjacent attribute specifications like:
<div xml:lang="de"lang="de">
...
This is not allowed in XML, there must be a white-space character between the attribute specifications, so write:
<div xml:lang="de" lang="de">

2. Is the CSS correct/incorrect?

Many thanks

Mike

Nile
03-27-2008, 02:54 AM
Instead of using a *:lang, I don't even know if thats valid, but replace it with a class, that might help, so try this:


<style type="text/css">
.lang(fr) { background-image:url(../css/flag/fr.gif);}
.lang(de) { background-image:url(../css/flag/gr.gif);}
</style>
<p>The French word for cat is <em class="lang(de)">chat</em></p>