[Solved] How does the browser connect html class names and css style entries? [closed]


I believe it’s more like the second. Basically:

Not necessarily in this order:

  • The browser parses the HTML and creates a bunch of objects called The Document Object Model, or DOM.
  • The browser parses the CSS. Each CSS block is made up of a selector and then a bunch of properties.
  • For each CSS block, the browser looks through the DOM for all the elements that match the selector and then applies the properties.

In your above example, the selector is a list of classes but there are other kinds of selectors.

Note that in real life things don’t always work out in that simple order as things can be loaded late, etc.

Hopefully that is of some help…

solved How does the browser connect html class names and css style entries? [closed]