overflow: hidden;
: λμΉλ ν
μ€νΈ μ보μ΄κ² μ€μ .example{
white-space:nowrap;
overflow:hidden;
text-overflow:ellipsis;
}
white-space: nowrap;
: μ€λ°κΏμ νμ§ μκ³ κ°μ μ€μ μ μ¨μ€
text-overflow:ellipsis;
: λμΉλ ν
μ€νΈ λ§μ€μ μ²λ¦¬
λͺ λ²μ§Έ μ€μμ λ§μ€μ μ²λ¦¬ν μ§ μ€μ
/* μΈ λ²μ§Έ μ€μμ λ§μ€μ */
.example {
overflow:hidden;
display: -webkit-box;
-webkit-box-orient: vertical;
-webkit-line-clamp: 3;
}
:κ°μμ΄λ²€νΈ
ννλ‘ νΉλ³ν μνμ μμλ₯Ό μ ν
/* 첫 λ²μ§Έ μμ μ ν */
li:first-child {
color: salmon;
}
/* λ§μ§λ§ μμ μ ν */
li:last-child {
color: royalblue;
}
/* liμ νμ μμ μ€ 3λ²μ§Έ μμ μ ν */
/* λ§μ½ μΈλ² μ§Έμ <li> μλ€λ©΄ μ μ©X */
li:nth-child(3) {
color: sandybrown;
}
/* μ§μ μμ μ ν */
li:nth-child(even) {
text-decoration: underline;
}
<div>
<p>첫λ²μ§Έ</p>
<p>λλ²μ§Έ</p>
<strong>μΈλ²μ§Έ</strong>
<p>λ€λ²μ§Έ</p>
<div>λ€μ―λ²μ§Έ</div>
</div>
/* νμ κ·Έλ£Ή μμ 3λ² μ§Έ μμ νκ·Έκ° <p>μΈ μμ */
/* μμ κ²½μ° 3λ²μ§Έ νκ·Έκ° <p>κ° μλλΌ <strong> μ΄μ΄μ μ μ© X */
p:nth-child(3) {
color: green;
}
/* div + ' '(곡백 - λͺ¨λ μμ μμ μλ―Έ) div μμ μμ μ€ nλ² μ§Έ */
/* μμ κ²½μ° <strong>μΈλ²μ§Έ</strong> μλ―Έ */
div :nth-child(3) {
text-decoration: underline;
}
/* νμ <div> μ€ 3λ² μ§Έ μμ */
/* μμ κ²½μ° μ‘΄μ¬ X */
div:nth-child(3) {
font-size: large;
}
/* νμ νκ·Έλ€ μ€ 3λ² μ§Έ <p> μμ */
p:nth-of-type(3) {
color: green;
}
/* <p>μ€ μ²«λ² μ§Έ, λ§μ§λ§μ΄ μλ μμ */
p:not(:first-child):not(:last-child){
color: green;
}
:root {
--main-color: hotpink;
}
ul {
background-color: var(--main-color);
}
π‘μ°Έκ³
κ°μν΄λμ€ μ νμdiv:not(:first-child)
μ 볡ν©μ νμdiv~div
κ°μ
- μΌλ° νμ μ νμ (~)λ μμ λ€μ λμ€λ νμ νκ·Έ μ 체 μ νμ΄κΈ° λλ¬Έμ, 첫 λ²μ§Έ divλ₯Ό μ μΈνκ³ κ·Έ λ€μ λμ€λ νμ div λͺ¨λλ₯Ό μ ν
margin-top: 20px;
κ°μ κ²½μ° μκΈ΄νκ² μ°μ!
- μ νν μμμ μμ μμ±
- 보ν΅
content
μμ±κ³Ό μ§μ μ§μ΄ μμμ μ₯μμ© μ½ν μΈ λ₯Ό μΆκ°- λΉνκ·Έ(λ«λ νκ·Έκ° μλ νκ·Έ)
<img>
br
input
μλ μ μ© X
<ul>
<li>μλ
νμΈμ</li>
<li>μ μμ</li>
</ul>
li {
list-style: none;
}
ul::before {
content: "[";
}
ul::after {
content: "]";
}
li::before {
content: "<";
}
li::after {
content: ">";
}