π 0526 νμ΅ μ 리
β
μμ 1: Google ν΄λ‘ νμ΄μ§
π§Ύ HTML (index.html)
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Google</title>
<link rel="stylesheet" href="../../5-box-model/common.css">
<link rel="stylesheet" href="styles.css">
</head>
<body>
<header>
<nav>
<ul>
<li><a href="#">Gmail</a></li>
<li><a href="#">μ΄λ―Έμ§</a></li>
<li><a href="#">λ‘κ·ΈμΈ</a></li>
</ul>
</nav>
</header>
<main>
<img src="https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png" alt="Google Logo" class="logo">
<div class="search-bar">
<input type="text" placeholder="Google κ²μ λλ URL μ
λ ₯">
</div>
<div class="buttons">
<button>Google κ²μ</button>
<button>I'm Feeling Lucky</button>
</div>
</main>
<footer>
<div class="footer-left">
<a href="#">κ΄κ³ </a>
<a href="#">λΉμ¦λμ€</a>
<a href="#">κ²μμ μ리</a>
</div>
<div class="footer-right">
<a href="#">κ°μΈμ 보</a>
<a href="#">μ½κ΄</a>
<a href="#">μ€μ </a>
</div>
</footer>
</body>
</html>
π¨ CSS (styles.css)
body {
background: #f8f8f8;
}
header {
height: 5vh;
}
header ul {
display: flex;
justify-content: right;
padding: 10px;
}
header ul li {
margin-left: 20px;
}
header ul li a {
font-size: 16px;
color: dimgray;
}
main {
height: 90vh;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
main img {
width: 30%;
margin-bottom: 10px;
}
main .search-bar input[type=text] {
font-weight: 700;
width: 30vh;
padding: 14px;
border-radius: 25px;
border: 1px solid #e3e3e3;
box-shadow: 0px 0px 6px lightgray;
transition: .4s;
}
main .search-bar input[type=text]:focus {
width: 35vh;
outline: none;
}
main .buttons button {
font-weight: 700;
background: #f8f8f8;
border: none;
box-shadow: 0 3px 4px #e8e8e8;
padding: 10px;
}
footer {
height: 5vh;
display: flex;
justify-content: space-between;
padding: 0 10px;
}
footer a {
font-size: 16px;
color: dimgray;
}
β
μμ 2: Instagram ν΄λ‘ νμ΄μ§
π§Ύ HTML (index.html)
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Instagram</title>
<link rel="stylesheet" href="../../5-box-model/common.css">
<link rel="stylesheet" href="main.css" />
</head>
<body>
<header>...</header>
<main>...</main>
<footer>...</footer>
</body>
</html>
π¨ CSS (main.css) μ€ μ£Όμ μ€νμΌ
body {
display: flex;
flex-direction: column;
}
header nav {
display: flex;
box-shadow: 0 3px 3px lightgray;
}
nav .logo { flex: 2; }
nav .search-bar { flex: 6; }
nav .nav-icons { flex: 2; display: flex; justify-content: right; }
main {
flex: 5;
background: #f8f8f8;
}
main .content-container {
display: flex;
justify-content: center;
}
footer {
height: 10%;
box-shadow: 0 -2px 3px lightgray;
display: flex;
justify-content: center;
}