[HTML&CSS] inherit

2020. 11. 27. 17:50HTML&CSS&JavaScript

inherit : 상속, 기본값(부모 엘리먼트의 값을 물려받음)

<inherit인 것> <inherit 아닌 것>
-color 
-font-size 
-font-weight 
-letter-spacing 
-display 
-background-color 
-border 
-margin 
-padding 
-width 
-height 
-border-radius 

<inherit 테스트>

<HTML>

----------------------
<br>
inherit인 것
<br>
-color
<br>
-font-size
<br>
-font-weight
<br>
-letter-spacing
<br>
----------------------
<br>
inherit 아닌 것
<br>
-display
<br>
-background-color
<br>
-border
<br>
-margin
<br>
-padding
<br>
-width
<br>
-height
<br>
-border-radius
<div>
  div
  <section>
    section
  </section>
  <section>
    section
  </section>
</div>

<CSS>

div{
  color:red;
  font-size:2rem;
  font-weight:bold;
  letter-spacing:10px;
  background-color:black;
  border:10px solid red;
  margin:20px;
  padding:30px;
  display:inline-block;
  width:500px;
  height:500px;
  border-radius:50%;
  
}
div>section{
  border:5px solid green;
  border-radius
}

 

codepen.io/cjy324/pen/QWKWajQ