Adapt JavaScript Library Instead of CSS Media Queries?

By HTMLGoodies Staff

Creating a website that looks good on a small screen as well as a desktop monitor can be a daunting task. Media queries that target specific devices with appropriate CSS is one way to handle the issue, but Adapt.js may be an even better solution.

Nathan Smith released Adapt.js, a lightweight JavaScript library, to enable developers to create a list of stylesheets along with the appropriate screen sizes that the style sheets should be loaded for. That way, instead of having to determine the user's device and supply an appropriate style sheet, JavaScript is used to determine their screen size and apply the stylesheet.

It doesn't take away the work required to build appropriate style sheets for each resolution, but it does handle all screen sizes, and hence, all devices, mobile or not.

View Full Article

  • Web Development Newsletter Signup

    Invalid email
    You have successfuly registered to our newsletter.
Thanks for your registration, follow us on our social networks to keep up-to-date