Reputation: 4171
For example here is a fiddle which shows how to change a font when the width drops below 200px.
@media (max-width: 200px) {
.test {
font-size:40px;
}
}
If you move the html window to the right to make it smaller you will see the point at which it hits 200px b.c. the font will change.
If someone could add a dynamic div to the fiddle so that this value would be output to the window this would be a cool test script for media queries.
Also, if there is a good reference on the web for the JavaScript interface to media queries. I hope there is one. I have not found it yet.
Upvotes: 0
Views: 68
Reputation:
Here is what you were actually asking for. The snippet below will output the dimensions that media query uses.
http://jsfiddle.net/jbnt7nh1/8/
// some code - updated fiddle
Here is a good point to start reading about the different widths in CSS.
https://www.google.com/#q=quirksmode+screen+width
Upvotes: 0
Reputation: 1582
I did using jQuery, hope this helps.
$( window ).resize(function() {
if($(window).width()<=200){
$(".test").css("font-size","40px");
}
else{
$(".test").css("font-size","20px");
} });
http://jsfiddle.net/7gup43rx/2/
Upvotes: 1