λͺ©μ°¨
728x90
μ λ²μκ°μ μ΄μ΄μ μμλΆμ¬ κ°μν΄λμ€!
μμλΆμ¬ κ°μν΄λμ€λhtmlμ λ°λ‘ ν΄λμ€λ₯Ό λΆμ¬νμ§ μμλ
μνλ μμ μ κ·Όν μ μλλ‘ νκΈ° μν΄μ μ¬μ©νλ€.
first-child
ν΄λΉ μ νμμ κ°μ₯ 첫 λ²μ§Έ μμ
last-child
ν΄λΉ μ νμμ κ°μ₯ λ§μ§λ§ μμ
λΉμ°νμ§λ§ nth-childμ λ¬λ¦¬ μμλ₯Ό λ»νλ μ«μλ νμνμ§ μλ€.
μμ
<div class="tab-inner">
<div class="btn">
<span>곡μ§μ¬ν</span>
<span>κ°€λ¬λ¦¬</span>
</div>
<div class="tab">
<a href="#none">2022 μ λ
μΈμ¬</a>
<a href="#none">μκ°μ μ² λ°©λ² μλ΄</a>
<a href="#none">μ₯νκΈ μ μ²κΈ°κ° μλ΄</a>
<a href="#none">볡ν μ μ² μλ΄</a>
<a href="#none">λκ³ λ°©ν κΈ°κ°μ€ λμκ΄ μ΄μ μλ΄</a>
</div>
</div>
μ 체 CSSμ½λ
.tab-inner {
width: 400px;
}
.btn span {
background-color: #ccc;
display: inline-block;
width: 120px;
padding: 5px;
font-weight: bold;
text-align: center;
border-radius: 5px 5px 0 0;
cursor: pointer;
border: 2px solid #000;
margin-right: -7px;
}
.btn span:first-child {
background-color: #fff;
border-bottom: 2px solid #fff;
margin-left: 10px;
margin-bottom: -4px;
}
.btn span:last-child {
border-bottom: 0px solid #fff;
}
.tab {
border: 2px solid #000;
}
.tab a{
display: block;
text-decoration: none;
color: #000;
border-bottom: 2px solid #000;
padding: 2px;
margin: 3px 10px 3px 10px;
transition: 0.4s;
}
.tab a:last-child{
border-bottom: 0;
}
.tab a:hover {
transition: 0s;
background-color: rgba(136, 153, 247, 0.3);
}
first-childμ last-childλ₯Ό μ΄μ©νμ¬ κ°λ¨ν κ²μν ννλ₯Ό λ§λ€μ΄λ³΄μλ€.
'π | WEB DEV > HTML CSS' μΉ΄ν κ³ λ¦¬μ λ€λ₯Έ κΈ
CSS _transition(1) (property, timing, delay) (0) | 2022.01.14 |
---|---|
CSSμ ν¬κΈ°λ¨μλ€!(px, em, rem, vw λ±) (0) | 2022.01.09 |
CSS κ°μν΄λμ€ (2)_μμ κ°μν΄λμ€[1] (nth-child, nth-of-type) (0) | 2022.01.07 |
CSS κ°μν΄λμ€ (1)-2_λ§μ°μ€ μ€λ² ν¨κ³Ό(hover, transition) μΆκ°! (0) | 2022.01.07 |
CSS κ°μν΄λμ€ (1)_λ§μ°μ€ μ€λ² ν¨κ³Ό(hover, transition) (0) | 2022.01.07 |
λκΈ