λͺ¨λ μΉμ μν HTML5+CSS3 λ°μ΄λΈ(5)
π λ€μ΄κ°κΈ°μ μμ
μ΄ κΈμ λͺ¨λ μΉμ μν HTML5+CSS3 λ°μ΄λΈ
μ 곡λΆνλ©° κΈ°μ΅ν΄λ λ΄μ©λ€μ κ°λ¨νκ² κΈ°λ‘ν κΈμ
λλ€.
μ±
μ λν μμΈν μ¬νμ λ§ν¬λ₯Ό μ°Έκ³ ν΄μ£ΌμΈμ. π
π 1. μ€λ§νΈν° λ μ΄μμ
μ½λλ₯Ό μ λμ΄νκ³ μ£ΌμμΌλ‘ λμλλ νλ€(πλ‘ νμν΄λκ² μ΅λλ€.)μ κΈ°λ‘νλ € ν©λλ€. μ½λ μλ³Έμ λ§ν¬μμ λ°μΌμ€ μ μμ΅λλ€.
μ΅κ·Όμλ HTML, CSS, Javascriptλ₯Ό νμ©ν΄ λ€μ΄ν°λΈ μ ν리μΌμ΄μ
μ λ§λλ React Native
, Vue Native
λ±μ κΈ°μ μ΄ νμ±νλμμ΅λλ€.
μ΄μ κ°μ λ°©λ²μΌλ‘ μ ν리μΌμ΄μ
μ λ§λ€λ©΄, μμ΄ν° λ° μλλ‘μ΄λ λ±μ μ ν리μΌμ΄μ
μ λ°λ‘ κ°λ°ν νμκ° μμ΄ λͺ¨λ OSμμ μ€νν μ μλ€λ μ₯μ μ΄ μμ΅λλ€. π
<!DOCTYPE html>
<html>
<head>
<title>Chapter 6</title>
<!-- π λ·°ν¬νΈ: λͺ¨λ°μΌ μΉ νμ΄μ§λ νλ©΄μ λν νΉλ³ν μ 보λ₯Ό μ 곡νκΈ° μν΄ λ·°ν¬νΈ meta νκ·Έλ₯Ό μ¬μ©ν©λλ€.
λΈλΌμ°μ μ νλ©΄ μ€μ κ³Ό κ΄λ ¨λ μ 보λ₯Ό μ 곡ν©λλ€.
----
initial-scale: μ΄κΈ° νλ λΉμ¨
user-scalable: νλ λ° μΆμ κ°λ₯ μ¬λΆ
minimum-scale: μ΅μ μΆμ λΉμ¨
maximum-scale: μ΅λ νλ λΉμ¨
----
-->
<meta
name="viewport"
content="width=device-width, initial-scale=1.0, minimum-scale=1.0, user-scalable=no"
/>
<!-- μ΄κΈ°ν -->
<style>
* {
margin: 0;
padding: 0;
}
body {
font-family: 'Helvetica', sans-serif;
}
li {
list-style: none;
}
a {
text-decoration: none;
}
</style>
<!-- ν€λ -->
<style>
#main_header {
/* λ°°κ²½ μ§μ */
height: 45px;
background: url('header_background.png');
/* μμ μμΉ μ§μ */
position: relative;
text-align: center;
line-height: 45px;
}
#main_header > h1 {
color: white;
}
#main_header > a,
#main_header > label {
display: block;
height: 32px;
position: absolute;
}
#main_header > a.left {
width: 62px;
left: 5px;
top: 7px;
}
#main_header > label.right {
width: 32px;
right: 5px;
top: 7px;
}
</style>
<!-- π μ€νλΌμ΄νΈ μ΄λ―Έμ§: μ΄λ―Έμ§λ₯Ό μ¬λ¬ κ° λμ³λμ κ²μ μλ―Έν©λλ€. μ΄λ κ² μ¬λ¬κ°μ μ΄λ―Έμ§λ₯Ό 1κ°μ μ΄λ―Έμ§λ‘ λμ³μ μ¬μ©νλ©΄
μΉ νμ΄μ§ μμ² μκ°μ μ€μ΄κ³ μ½κ² κ΄λ¦¬ν μ μμ΅λλ€.
μ€νλΌμ΄νΈ μ΄λ―Έμ§ λ§λ€κΈ°: https://www.toptal.com/developers/css/sprite-generator/ -->
<style>
#main_header > a.left {
background: url('sprites.png');
background-position: 0px 0px;
text-indent: -99999px;
/* π ν
μ€νΈλ₯Ό λ€μ¬μ°κΈ°, λ΄μ΄μ°κΈ°νλ μ©λλ‘, μ¬κΈ°μλ νκ·Έ λ΄λΆ κΈμλ₯Ό μ보μ΄κ² νλ € μμ£Ό μΌμͺ½ λμΌλ‘ 보λ΄λ²λ¦° κ²μ
λλ€.
κΈμλ₯Ό μ
λ ₯νμ§ μμλ λκΈ΄ νμ§λ§, κ·Έ μλ¦¬κ° μ΄λ ν μ©λμΈμ§ μκΈ° μ½κ² μ΄λ κ² μ¬μ©νκΈ°λ ν©λλ€. */
}
#main_header > label.right {
background: url('sprites.png');
background-position: -62px 0px;
text-indent: -99999px;
}
</style>
<!-- ν κΈ λͺ©λ‘ -->
<style>
/* ν κΈ κ΅¬ν */
#toggle {
display: none;
}
#toggle + #wrap > #toggle_gnb_wrap {
display: none;
}
#toggle:checked + #wrap > #toggle_gnb_wrap {
display: block;
}
/* λ μ΄μμ μμ */
#toggle_gnb_wrap {
background: #363636;
padding: 15px;
}
#toggle_gnb {
background: #ffffff;
padding: 5px;
}
/* ν κΈ λͺ©λ‘ */
#toggle_gnb > ul {
overflow: hidden;
}
#toggle_gnb > ul > li {
width: 80px;
float: left;
}
</style>
<!-- π λ€λΉκ²μ΄μ
(1): overflowμ floatμ μ¬μ©νμ¬ navλ₯Ό λ§λλ λ°©λ²μ
λλ€. -->
<style>
#top_gnb {
overflow: hidden;
border-bottom: 1px solid black;
background: #b42111;
}
#top_gnb > div > a {
/* μν μ λ ¬ */
float: left;
width: 25%;
/* ν¬κΈ° λ° μμ, μ λ ¬ */
height: 35px;
line-height: 35px;
text-align: center;
color: white;
}
</style>
<!-- π λ€λΉκ²μ΄μ
(2): displayμ table ν€μλλ₯Ό μ¬μ©νμ¬ navλ₯Ό λ§λλ λ°©λ²μ
λλ€. -->
<style>
#bottom_gnb {
display: table;
width: 100%;
border-bottom: 1px solid black;
}
#bottom_gnb > div {
display: table-cell;
position: relative;
}
#bottom_gnb > div > a {
display: block;
height: 35px;
line-height: 35px;
text-align: center;
}
/* π ::beforeλ₯Ό μ¬μ©νμ¬ κ° μμ μ(μ΄μ )μ κ²μμ μμ§μ μ λ§λλλ€. */
#bottom_gnb > div > a::before {
display: block;
position: absolute;
top: 9px;
left: -1px;
width: 1px;
height: 15px;
border-left: 1px solid black;
content: '';
}
</style>
<!-- λ³Έλ¬Έ -->
<style>
#section_header {
padding: 20px;
}
#section_article {
padding: 10px;
}
</style>
<!-- νΈν° -->
<style>
#main_footer {
padding: 10px;
border-top: 3px solid black;
text-align: center;
}
</style>
</head>
<body>
<input id="toggle" type="checkbox" />
<!-- π body μ체μ μ€νμΌμ μ μ©νλ κ²μ΄ μνν μλ μλ€κ³ μκ°νλ κ°λ°μλ€μ΄ #wrapμΈ divλ₯Ό λ°λ‘ λ§λ€κΈ°λ ν©λλ€.
λ¬Όλ‘ λ°λμ μ΄λ° κ²½μ°κ° μλλλΌλ νΉλ³ν κ²½μ°μ μ¬μ©νκΈ°λ ν©λλ€.
μ¬κΈ°μλ μΌλΆ μ€λ§νΈν° μΉ λΈλΌμ°μ λ ~ μ νμ μ¬μ©μ΄ λΆκ°λ₯νκΈ°μ μ¬μ©νμμ΅λλ€. -->
<div id="wrap">
<header id="main_header">
<a class="left" href="#">Main</a>
<h1>Mobile</h1>
<label class="right" for="toggle" onclick="">Toggle</label>
</header>
<div id="toggle_gnb_wrap">
<div id="toggle_gnb">
<ul>
<li><a href="#">λ²νΌ</a></li>
<li><a href="#">λ²νΌ</a></li>
<li><a href="#">λ²νΌ</a></li>
<li><a href="#">λ²νΌ</a></li>
<li><a href="#">λ²νΌ</a></li>
<li><a href="#">λ²νΌ</a></li>
<li><a href="#">λ²νΌ</a></li>
<li><a href="#">λ²νΌ</a></li>
</ul>
</div>
</div>
<nav id="top_gnb">
<div><a href="#">λ²νΌ</a></div>
<div><a href="#">λ²νΌ</a></div>
<div><a href="#">λ²νΌ</a></div>
<div><a href="#">λ²νΌ</a></div>
</nav>
<nav id="bottom_gnb">
<div><a href="#">λ²νΌ</a></div>
<div><a href="#">λ²νΌ</a></div>
<div><a href="#">λ²νΌ</a></div>
<div><a href="#">λ²νΌ</a></div>
<div><a href="#">λ²νΌ</a></div>
</nav>
<section id="main_section">
<header id="section_header">
<h1>Lorem ipsum</h1>
<time>2012-12-09 - Birthday</time>
</header>
<article id="section_article">
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur in magna libero. Sed
nec pharetra nunc. Proin eget magna id ipsum eleifend cursus sit amet nec lectus. Nunc
quis lacus magna. Aliquam blandit, sapien ut viverra fermentum, elit tortor ornare nisi,
in luctus sem massa pulvinar turpis. Cras tincidunt dictum urna ut ultricies. Nullam
diam nibh, pellentesque non laoreet ut, bibendum nec mauris. Maecenas pulvinar porttitor
laoreet. Vivamus bibendum purus nisl, eget aliquam lectus. Maecenas justo libero,
euismod sit amet suscipit eu, vulputate eget neque. Aliquam quam est, blandit nec
iaculis non, suscipit vel nunc. Proin et odio aliquam erat pharetra accumsan et quis
neque. Vivamus interdum accumsan leo eu adipiscing. Integer accumsan elit non turpis
faucibus porttitor. Aliquam scelerisque nisi et turpis pretium at ultricies turpis
pharetra.
</p>
<br />
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur in magna libero. Sed
nec pharetra nunc. Proin eget magna id ipsum eleifend cursus sit amet nec lectus. Nunc
quis lacus magna. Aliquam blandit, sapien ut viverra fermentum, elit tortor ornare nisi,
in luctus sem massa pulvinar turpis. Cras tincidunt dictum urna ut ultricies. Nullam
diam nibh, pellentesque non laoreet ut, bibendum nec mauris. Maecenas pulvinar porttitor
laoreet. Vivamus bibendum purus nisl, eget aliquam lectus. Maecenas justo libero,
euismod sit amet suscipit eu, vulputate eget neque. Aliquam quam est, blandit nec
iaculis non, suscipit vel nunc. Proin et odio aliquam erat pharetra accumsan et quis
neque. Vivamus interdum accumsan leo eu adipiscing. Integer accumsan elit non turpis
faucibus porttitor. Aliquam scelerisque nisi et turpis pretium at ultricies turpis
pharetra.
</p>
<br />
<p>
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur in magna libero. Sed
nec pharetra nunc. Proin eget magna id ipsum eleifend cursus sit amet nec lectus. Nunc
quis lacus magna. Aliquam blandit, sapien ut viverra fermentum, elit tortor ornare nisi,
in luctus sem massa pulvinar turpis. Cras tincidunt dictum urna ut ultricies. Nullam
diam nibh, pellentesque non laoreet ut, bibendum nec mauris. Maecenas pulvinar porttitor
laoreet. Vivamus bibendum purus nisl, eget aliquam lectus. Maecenas justo libero,
euismod sit amet suscipit eu, vulputate eget neque. Aliquam quam est, blandit nec
iaculis non, suscipit vel nunc. Proin et odio aliquam erat pharetra accumsan et quis
neque. Vivamus interdum accumsan leo eu adipiscing. Integer accumsan elit non turpis
faucibus porttitor. Aliquam scelerisque nisi et turpis pretium at ultricies turpis
pharetra.
</p>
</article>
</section>
<footer id="main_footer">
<h3>HTML5 + CSS3 Basic</h3>
<address>Website Layout Basic</address>
</footer>
</div>
</body>
</html>
π μ 리
μ€μν λ΄μ©
- λ·°ν¬νΈ meta νκ·Έ
- μ€νλΌμ΄νΈ μ΄λ―Έμ§
- nav λ§λλ λ°©λ²
- overflowμ float μμ± νμ©
- display μμ±κ³Ό table ν€μλ νμ©
- ::before μ νμλ₯Ό μ¬μ©νμ¬ μμ§μ μμ±νκΈ°
β κΈμ κ°μΆκΈ° : Ellipsis(μλ΅)νλ κΈ°μ
νλ©΄μ΄ μμ κΈ°κ³μμλ κΈμκ° μ릴 μ μμ΅λλ€.
μ΄ λ μλ¦° λΆλΆμ '...'
μΌλ‘ λ체νμ¬ λ μ΄μμμ΄ κΉ¨μ§μ§ μλλ‘ ν΄μ£Όλ λ°©λ²μ
λλ€.
block νμμ νκ·Έμ μλμ κ°μ΄ μ€νμΌλ§μ μ§μ νμ¬ μ¬μ©ν©λλ€.(μ£Όλ‘ h1κ°μ μ λͺ© νκ·Έμ μ¬μ©ν©λλ€.)
div {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}