1

I need to make sure my page looks good in different screen sizes. The best solution is probably CSS3 media queries.

However, a large part of my target user base are still using IE <= 8. I plan to write some js to re-style elements (font-size, etc) based on window size when page is loaded. What is the best way to do this?

  1. Is there any existing solid solution to this problem (A git repo)?
  2. Should I use:
    • javascript for IE<8 + media queries for other browsers, or
    • javascript code for every browser?
2
  • 3
    why not use respond.js? Commented Apr 11, 2014 at 9:39
  • 1
    Search for adapt.js in google. you might get your answer. Commented Apr 11, 2014 at 10:29

2 Answers 2

1

Using respond.js together with Modernizr to load it is a simple enough solution. When using Modernizr you don't need to ship the poyfill for most of the Internet (modern browsers), and only load it for the old ones. Example:

Modernizr.load({
  test: Modernizr.mq('only all'),
  nope: ['respond.js']
});

Basically what respond.js does is add support for media queries to old browsers, so you can write responsive CSS and it will "just work" on old IE.

Sign up to request clarification or add additional context in comments.

2 Comments

I am not using modernizr (maybe I should). Using it just for adpating some css is a bit heavy-weight. I might try 'if IE' conditionals along with respond.js (or adapt.js) for this first.
Using respond.js alone is perfectly fine - the only downside is that users with modern brosers need to download the polyfill, even though they don't need it.
1

You might also like a look at this jquery responsive plugin. Its a very lightweight plugin that manages the whole reflow problem on all browsers, making the CSS you need to write much less.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.