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