Today I have learned media query of web view in javascript
Media query of web view :
Using Media Queries With JavaScript
Media queries was introduced in CSS3, and is one of the key ingredients for responsive web design. Media queries are used to determine the width and height of a viewport to make web pages look good on all devices (desktops, laptops, tablets, phones, etc).
The window.matchMedia() method returns a MediaQueryList object representing the results of the specified CSS media query string. The value of the matchMedia() method can be any of the media features of the CSS @media rule, like min-height, min-width, orientation, etc.
What is the best way to implement a JavaScript media query?
- Media query strings are defined in a JSON (or similar) file and the values are slotted into the CSS and JavaScript code at build time. In summary, the matchMedia API is likely to be the most efficient and practical way to implement a JavaScript media query. It has some quirks, but it’s the best option in most situations.
- @media all and (max-width: 4900px) {.update{font-size: 60px;}}@media all and (max-width: 3849px) {.update {font-size: 50px;}}@media all and (max-width: 2349px) {.update {font-size: 40px;}}@media all and (max-width: 2144px) {.update {font-size: 30px;}}@media all and (max-width: 1991px) {.update {font-size: 20px;}}@media all and (max-width: 1715px) {.update {font-size: 10px;}}@media all and (max-width: 1588px) {.update {font-size: 5px;}}@media all and (max-width: 1515px) {.update {font-size: 15px;}}Output:
.png)

.png)



Comments
Post a Comment