Jump to content

PawelX

Members
  • Posts

    2
  • Joined

  • Last visited

Everything posted by PawelX

  1. https://www.w3schools.com/css/css_specificity.asp There are two statements on that page that I can't wrap my head around: 1 "Equal specificity: the latest rule counts - If the same rule is written twice into the external style sheet, then the lower rule in the style sheet is closer to the element to be styled, and therefore will be applied: h1 {background-color: yellow;} h1 {background-color: red;}" In what sense is the rule "closer to the element"? It comes last (so it's logical that it overrides any previous rules with the same specificity), but I don't know in what sense it's "closer". 2 "Contextual selectors are more specific than a single element selector - The embedded style sheet is closer to the element to be styled." I've no idea what the underlined statement means in the context. How is a selector in an external file a "single element selector"? Doesn't the embedded selector also select a single element (the same one)? And how is that related to being "closer"? THANK YOU
  2. https://www.w3schools.com/css/css_specificity.asp There are two statements on that page that I can't wrap my head around: 1 "Equal specificity: the latest rule counts - If the same rule is written twice into the external style sheet, then the lower rule in the style sheet is closer to the element to be styled, and therefore will be applied: h1 {background-color: yellow;}h1 {background-color: red;}" In what sense is the rule "closer to the element"? It comes last (so it's logical that it overrides any previous rules with the same specificity), but I don't know in what sense it's "closer". 2 "Contextual selectors are more specific than a single element selector - The embedded style sheet is closer to the element to be styled." I've no idea what the underlined statement means here. How is a selector in an external file a "single element selector"? Doesn't the embedded selector also select a single element (the same one)? And how is that related to being "closer"? THANK YOU
×
×
  • Create New...