JS implements responsive simple code

Source: Internet
Author: User
JS response implementation is also based on different CSS style sheets for external use. by obtaining the screen width of different devices, different CSS style sheets can be selectively loaded. I. CSS implementation response

CSS response implementation mainly relies on CSS media queries:

A media query contains an optional media type and zero or multiple expressions to limit the range of style tables that use media features, such as width, height, and color. Media queries in CSS3 allows the content to be displayed only for output devices in a specific range, without changing the content itself. The screen width is determined by media queries and different CSS style sheets are loaded.

The Code is as follows: Be sure to have a default style sheet without media queries; otherwise, style sheets will not exist when accessed in IE8.

  
   Responsive demonstration  
   
   
   
   
 

Ii. JS implementation response

JS response implementation is also based on different CSS style sheets for external use. by obtaining the screen width of different devices, different CSS style sheets can be selectively loaded.

  
    Responsive demonstration  
    
    
    
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.