티스토리 뷰
📌 가상요소
● 특징1: :: 를 사용해 표시
● 특징2: content의 필수입력
● 특징3: 가상요소에서 가장 중요한 before, after 태그로 전 훅 관계를 나타냄
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<style>
.coding::first-line {
color: red;
}
div {
position: relative;
}
/*
가상 요소 중 가장 중요하고 많이 사용하는 요소
필수요소: content
before 같은경우 css의 글자 이미지가 있어야하는 경우 사용된다.!!
*/
.coding::before {
content: "";
position: absolute;
width: 100px;
height: 100px;
background-color: red;
top: 0;
left: 0;
}
.coding::after {
content: ";";
}
</style>
</head>
<body>
<p class="coding">
Lorem ipsum dolor, sit amet consectetur adipisicing elit. Debitis voluptatibus, maiores quo aperiam modi cumque accusamus, beatae sit hic, ab dolorem atque a enim sapiente quasi numquam
quibusdam placeat nihil.
</p>
</body>
</html>'css' 카테고리의 다른 글
| [CSS] z-index를 활용한 모달창 연습 (0) | 2023.01.16 |
|---|---|
| [CSS] POSITION 학습 (0) | 2023.01.16 |
| [CSS] 가상클래스 (0) | 2023.01.15 |
| [CSS] 선택자 (0) | 2023.01.14 |
| [CSS] 태그 및 기본 용어 정리 (0) | 2023.01.10 |
