CSS - How it works


Tags: css

Problem :

i want to know how CSS works.. how browsers execute whatever is designed in CSS...

lets say

when a page is loaded and it has multiple CSS file attached to it, and mouse goes over some anchor and finds a class set for it it will go search all the CSS files for the relative class and read its hover state and then render it...

HOW HOW.. how this works... you might have guess what i want to ask...



Solution :

That's an exceptionally broad and complicated question. It's essentially asking, "How do browsers render pages?" This video showcases how Gecko happens to do it for a sample page. Seeing the rendering process broken down like that may give some sense of just how complicated it is.

Ultimately, since the CSS specification gives no requirements or even guidance about implementation, every browser (or, we should say, "every rendering engine") will do things differently. If you were to write a new browser from scratch today, you'd be free to explore any algorithm you wanted.

The idea to read through every rule and see which ones match (for each element) is certainly a viable starting point, though almost certainly some optimizations and caching would need to get tacked on to make that perform acceptably for stylesheets with real-world complexity.

Fortunately for you, though, both the major rendering engines in use today (Webkit and Gecko) are open source, and you are free to download them, explore the code, and even make changes. And that's really the only way to learn how those engines work at that level of detail.


    CSS Howto..

    How to clear the (CSS) visited history of an Android WebView?

    How to make custom css fonts render exactly like designs

    How can CSS interfere with JavaScript?

    How can I align the checkboxes in a form when using table display with CSS?

    How to make each element to be fully independend with CSS?

    How to use a sprite for a background on a div, positioning to a part of the sprite to the right of the div

    How do I make a hamburger menu display on the right side?

    How to wrap image around the long text?

    How to make a CSS rule act differently inside another div tag?

    How to get a tag the focus

    how to pass jquery variable value into css property value?

    (CSS) Set Id for Class How to Use

    How to create a CSS border surrounding an input box?

    How to avoid the particular class from applying css

    How do I use CSS with simple form?

    How do I use a gradient as a font color in CSS?

    Slideshow using MooTools JavaScript - How can I position slideshow to rescale in browser window

    How to override CSS3 animation with jQuery?

    How to design resolution independent CSS elements?

    how to override the specific style of spans in a div [span in a span ] using css or jquery?

    How do I make an image semi-transparent?

    How to exclude last child in css psuedo class selector

      list only showing contents of first
    • , ignoring second

    How to change CSS pseudo-class element using JavaScript

    How to provide some space between two lines of same text in css

    How to align 3 child div in a parent div

    How can I centre an unordered list of floated items to the page

    CSS how to style the “content”/“background” attribute of a custom checkbox tick sign?

    How to make CSS file more important than another CSS file? [closed]

    how to get value from this html date-ranger?