SG
0
What is the lang attribute used for in this example?
I was looking at the source of an email I got from Lynda.com and noticed code like
<td class="full" lang="x-full" ...
and CSS like
div[class="full"],
td[class="full"],
* [lang~="x-full"] {
width:100%!important;
}
Any ideas what this is doing? Never seen it before.
This is for Gmail (on the desktop webmail only). Gmail actually supports
<style>
tags, but filters anyid
orclass
from the HTML code. But Gmail doesn't filter certain attributes, likealt
,title
,dir
,aria-labelledby
orlang
. So you can use those attributes to actually target some elements from your HTML in CSS. The*
at the beginning is there to ensure that Gmail won't strip this selector.You can read more examples about this at Fresh Inbox, on Mark Robbins' blog or on my own blog (in french).
Thanks, this trick doesn't seem to be very popular, haven't seem this technique being used so far.