How to change text (not font size) according to screen size in CSS?

Have 2 spans with full and short strings, then when below target resolution, swap between them using a media query: HTML <span class=”full-text”>Saturday</span> <span class=”short-text”>Sat</span> CSS // Hide short text by default (resolution > 1200px) .short-text { display: none; } // When resolution <= 1200px, hide full text and show short text @media (max-width: 1200px) … Read more

What is the media query for large desktops?

The challenges of optimizing for large-scale displays center around how to scale and manage content. You need to assume screen width at certain points. Example: for class “container” @media screen and (min-width: 1400px) { .container { width: 1370px; } } @media screen and (min-width: 1600px) { .container { width: 1570px; } } @media screen and … Read more

@media queries and image swapping [closed]

In the future please add code you’ve tried. if it’s an image tag you can use a class. Hide the second image on page load and show + hide image 1 at a certain screen size like so: HTML <img src=”image.jpg” class=”image1″/> <img src=”image.jpg” class=”image2″/> CSS .image2{ display: none; } @media only screen and (max-width: … Read more

What Are The Best Width Ranges for Media Queries

Try this one with retina display /* Smartphones (portrait and landscape) ———– */ @media only screen and (min-device-width : 320px) and (max-device-width : 480px) { /* Styles */ } /* Smartphones (landscape) ———– */ @media only screen and (min-width : 321px) { /* Styles */ } /* Smartphones (portrait) ———– */ @media only screen and … Read more

Is there an advantage in grouping css media queries together?

A bit late to the party, but based on the tests below the performance impact seems to be minimal. The test shows the rendering times for an example page with 2000 separate and combined media queries, respectively. http://aaronjensen.github.com/media_query_test/ The main benefit seems to be in file size more than anything else – which, if you’re … Read more

Is there a CSS media query to detect Windows?

there is no property to specify OS used to view webpage, but you can detect it with javascript, here is some example for detecting Operating system : var OSName=”Unknown OS”; if (navigator.appVersion.indexOf(“Win”)!=-1) OSName=”Windows”; if (navigator.appVersion.indexOf(“Mac”)!=-1) OSName=”MacOS”; if (navigator.appVersion.indexOf(“X11″)!=-1) OSName=”UNIX”; if (navigator.appVersion.indexOf(“Linux”)!=-1) OSName=”Linux”; console.log(‘Your OS: ‘+OSName); got it?, now you can play with document.write to write … Read more

tech