I am trying to use media queries to change the width of an element in pieces based on the width of the window (this allows me to increase the number of columns on the page without changing the width of the columns). I would like to do this using em instead of pixels so that everything looks right if you change the font size. However, if I use the following:
html { font-size: 12px; /* you could also use 75% if you want to be percent based.*/ } @media screen and (min-width: 42em) { div#page { width: 42em; } }
The media request will be triggered when the minimum window width reaches 42 * 16 pixels, the default font size for my browser (Safari), and the page div # will be 42 * 12 pixels wide, inheriting the font size from the html element. I would really like for media queries to be called based on the width of the text I use, is there any way to make this work?
html css css3 media-queries viewport
macrael
source share