가상요소
<!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>특수효과</title>
<style>
body {
font-family: 'Franklin Gothic Medium', 'Arial Narrow', Arial, sans-serif;
background: #333;
color: #fff;
}
/* 앞쪽에 붙임 */
.is-required::before {
content: '⭐';
color: white;
padding-right: 2px;
}
/* 뒤쪽에 붙임 */
.is-required::after {
content: '⭐';
color: white;
padding-left: 2px;
}
/* 예제 2 */
header {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
text-align: center;
height: 100vh;
}
header h1 {
font-size: 6rem;
margin: 1rem;
}
header::before {
content: '';
background: url('https://source.unsplash.com/1600x900/?nature,water') no-repeat center center/cover;
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
/* 겹쳤을때 아래쪽 기본 0 */
z-index: -1;
/* 투명도 */
opacity: 0.5;
}
</style>
</head>
<body>
<!-- <label class="is-required" for="name">Name</label>
<input type="text" /> -->
<header>
<h1>Hello World</h1>
<p>
Lorem, ipsum dolor sit amet consectetur adipisicing elit. Ipsam, hic!
</p>
</header>
</body>
</html>