I assume that, just like the media queries that are used in link tags, the media queries which we define in our CSS files are parsed/overwritten or omitted by the browser according to their media query rules (Actually I know that, although the CSS files requested by the link tags with unmatched media are anyway downloaded, they are not render blocking the browser). So, from the CSSOM build optimization stand point, isn't it better to separate the generic CSS rules that applies to all screen devices from the mobile specific CSS rules and encapsulate the mobile specific rules in a max-width media query? So that browser will parse less CSS to build CSSOM without the need of overwriting them for tablet, desktop etc. I wonder if that would affect the building of CSSOM performance or is it just overkill?
Media queries: Overriding CSS rules vs defining screen specific CSS rules
99 Views Asked by BWV831 At
1
There are 1 best solutions below
Related Questions in CSS
- How to use custom font during html to pdf conversion?
- Storing the preferred font-size in localStorage
- mp4 embedded videos within github pages website not loading
- Is there any way to glow this bulb image like a real light bulb
- What can I do to improve my coding on both html and css
- Uncaught TypeError: google.maps.LatLng is not a constructor at init (script.js:7:13)
- Bootstrap modal not showing at the desired position on a web page when the screen size is smaller
- How to increase quality of mathjax output?
- Hover animation resetting( seemingly reverting back to original CSS and then again to hover)when moving mouse horizontaly accross a part of an element
- Storing selected language in localStorage
- How to clip grid cell and provide scroll as well?
- KeyboardAvoidingView makes a messy the flexbox
- Rotate an object around another object in javascript
- Understanding Scroll Anchoring Behavoir
- how to use only block layout in this css code?
Related Questions in MEDIA-QUERIES
- How to change WooCommerce notice "info" background color on smaller screens?
- How does CSS properties from figma files in 1920X1080 screen resolution work on different laptop screen resolution?
- Issue aligning footer page selector to center in less using media queries
- Tailwind media queries not working properly
- How to solve content overflow issues when you have too many items and why is media queries not working?
- Reduce duplication in media queries
- Text does not want to wrap when I shrink down the window from desktop to mobile banner
- How to set specific width and height of a div element when media queries are present in css file?
- White Space appearing on the right side of my app when opening from mobile
- How to change desktop-first design code to mobile-first with tailwind css (responsiveness)
- Defining the Media Query and after that giving css style to stop overflow-x but in output it takes the css style, still overflow-x scroll is visible?
- Issue with SCSS media query on iPhone 15 and Xiaomi Mi9
- Need help adjusting Foundation 5 CSS top-bar breakpoint
- Why is the first step moving with the page when changing the responsive layout?
- Meta tag not working to change address bar color's of safari desktop in dark mode
Related Questions in CSSOM
- What is the detailed process of generating Render tree?
- CSS Typed Object Model: Use instance methods of CSSNumericValue with CSS variables
- ReferenceError: CSS is not defined
- At what point in the parsing/rendering process do HTML elements get assigned a box model?
- How to create a render tree form DOM and CSSOM?
- How to print HTML before DOM tree is parsed?
- JS RegEx to return a hyphenated word and then another word/value
- Serialize programmatic CSS style sheets (stylesheets that use CSSOM API)?
- How to get the inherited values of element from JavaScript
- When using styled-components together with content-security-policy React SPA fails to render on iOS Safari
- Media queries: Overriding CSS rules vs defining screen specific CSS rules
- How to detect device's screen resolution on macbook?
- How to show hidden pseudo-element with JavaScript
- How can I create CSS variables with JavaScript?
- Where is the best place to put external css files (performance-wise)?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
<link>tags with unmatched media queries are download with low priority so that they don't block page rendering, but are still downloaded in order to be available in case media properties change (for example by rotating a smartphone or by zooming out a desktop browser). There is an advantage in having separate stylesheets for different media types, but there is also a disadvantage in creating multiple HTTP requests.Media blocks inside a stylesheet are already downloaded and I would assume that they are compiled anyway, so it's not really the same as a media query in the tag. But if a certain set of rules is only relevant to a certain width and is always overriden in wider screens, it makes sense to tell the browser that by encapsulating it inside a media query. It's not just about the original page rendering but about any change to the window or to the DOM that requires a redraw - the less rules the browser would need to evaluate, the faster it would be.