Question: how css works in browser?
Answer: The browser loads the HTML (e.g. receives it from the network). It converts the HTML into a DOM (Document Object Model). ... The browser parses the fetched CSS, and sorts the different rules by their selector types into different "buckets", e.g. element, class, ID, and so on.