Translation with CSS

A way to translate a part of HTML document with CSS, although you have all translations in one place hidden so it is not recommended for SEO, this way also overwrite the same CSS rule, but sometimes it may be useful. CSS defines language from HTML header document information, for example for English it would be “lang=en”.

span #textblock_en {display: none;}
span #textblock_fr {display: none;} 
span #textblock_ru {display: none;}

:lang(en) #textblock_en {display: block;}
:lang(fr) #textblock_fr {display: block;}
:lang(ru) #textblock_ru {display: block;}

Advertisements
Translation with CSS

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s