Last active
December 21, 2015 16:18
-
-
Save illarionvk/6332542 to your computer and use it in GitHub Desktop.
Append language abbreviation (EN, RU, PL) in superscript to a link if the language of the page is different.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@mixin linksignify-superscript { | |
font-size: 0.83em; | |
line-height: 0.5em; | |
vertical-align: baseline; | |
position: relative; | |
top: -0.4em; | |
left: 0.1em; | |
} | |
// Append language abbreviation (EN, RU, PL) in superscript to a link if the language of the page is different. | |
html:not([lang^='en']) { | |
a[hreflang^='en']:after { | |
content: 'en'; | |
text-transform: uppercase; | |
@include linksignify-superscript; | |
} | |
} | |
html:not([lang^='ru']) { | |
a[hreflang^='ru']:after { | |
content: 'ru'; | |
text-transform: uppercase; | |
@include linksignify-superscript; | |
} | |
} | |
html:not([lang^='pl']) { | |
a[hreflang^='pl']:after { | |
content: 'pl'; | |
text-transform: uppercase; | |
@include linksignify-superscript; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
CSS selectors that look like regular expressions affect performance:
https://github.com/stubbornella/csslint/wiki/Disallow-selectors-that-look-like-regular-expressions
If you do not plan to specify 'lang' and 'hreflang' as "en_US" or "fr_FR", it's better to go with simple check. If you need full language id support, look at Revision 1