[css] Inheritance In CSS

2018. 7. 13. 23:12・Frontend/HTML, CSS

Every CSS property must have a value.

Is there a cascaded value?

 

-if yes,

Specified value == Cascaded value

 

-if not,

Is the property inherited?(specific to each property)

 

and if yes,

Specified value == Computed value of parent element

∴ This is Inheritance!

 

if not,

Specified value == Initial value(specific to each property)

 

  • like padding and margin -> not inherited. be extremely impracticable.
  • Inheritance passes the value for some specific properties from parents to children - more maintainable code!
  • Properties related to text are inherited : font-family, font-size, color, etc.
  • The computed value of a property is what gets inherited, not the declared value.
  • Inheritance of a property only works if no one declares a value for that property.
  • The inherit keyword forces inheritance on a certain property.
  • The initial keyword resets a property to its initial value.

 

저작자표시 비영리 (새창열림)

'Frontend > HTML, CSS' 카테고리의 다른 글

[Sass] Architect : the 7 - 1 pattern  (0) 2018.07.20
[css] the problem of setting the font-size to pixels of body element  (0) 2018.07.15
[css] How UNITS are converted from relative to absolute(px)  (0) 2018.07.13
[css] How CSS Works? and what is Specificity?  (0) 2018.07.12
px, %, rem, em 변환과정  (0) 2017.12.27
'Frontend/HTML, CSS' 카테고리의 다른 글
  • [Sass] Architect : the 7 - 1 pattern
  • [css] the problem of setting the font-size to pixels of body element
  • [css] How UNITS are converted from relative to absolute(px)
  • [css] How CSS Works? and what is Specificity?
dev.hyejin
dev.hyejin
  • dev.hyejin
    혜진의 개발자 성장블로그
    dev.hyejin
  • 전체
    오늘
    어제
    • 분류 전체보기 (89)
      • 2024 데브캠프 (2)
      • 회고 (1)
      • 이슈해결 (3)
      • 기초학습 (13)
      • Frontend (20)
        • JavaScript (3)
        • Git, GitHub (3)
        • HTML, CSS (14)
      • Backend (8)
        • Database (4)
        • Java (4)
      • CS (16)
        • Network (10)
        • Algorithm (6)
      • Eng (16)
      • Tips (5)
  • 인기 글

  • 태그

    GitHub
    border-box
    상대경로
    시간복잡도
    객체
    점근성능
    절대경로
    box-sizing
    ER모델
    런타임
  • hELLO· Designed By정상우.v4.10.3
dev.hyejin
[css] Inheritance In CSS
상단으로

티스토리툴바