: style์ html์ ๋ฌธ๋ฒ์ผ๋ก,
์ด style ํ๊ทธ ์์ชฝ์ ๋ด์ฉ์ CSS์ด๋๊น, ์ด ์์ชฝ์ ๋ด์ฉ์ CSS๋ผ๋ ์ธ์ด์ ๋ฌธ๋ฒ์ ๋ง๊ฒ ํด์ํด์ ์ฒ๋ฆฌํด์ผํด. ๋ผ๋ ๋ป
(CSS์ฝ๋๋ฅผ HTML์ ํ๊ทธ์ธ style๋ก ๊ฐ์ธ๊ธฐ)
<h1><a href="index.html"><font color="red">WEB</font></a></h1>
<ol>
<li><a href="1.html"><font color="red">HTML</font></a></li>
<li><a href="2.html"><font color="red">CSS</font></a></li>
<li><a href="3.html"><font color="red">JavsScript</font></a></li>
</ol>
<style>
a{
color: red;
}
</style>
</head>
<body>
<h1><a href="index.html">WEB</a></h1>
<ol>
<li><a href="1.html">HTML</a></li>
<li><a href="2.html">CSS</a></li>
<li><a href="3.html">JavsScript</a></li>
</ol>
<style>
a{
color: black;
}
</style>
</head>
<body>
<h1><a href="index.html">WEB</a></h1>
<ol>
<li><a href="1.html">HTML</a></li>
<li><a href="2.html"style="color:red">CSS</a></li>
<li><a href="3.html">JavsScript</a></li>
</ol>
-code:
<style>
a{
text-decoration: none;
}
</style>
</head>
<body>
<h1><a href="index.html">WEB</a></h1>
<ol>
<li><a href="1.html">HTML</a></li>
<li><a href="2.html">CSS</a></li>
<li><a href="3.html">JavsScript</a></li>
</ol>
-code
<style>
a{
color: black;
text-decoration: none;
}
</style>
</head>
<body>
<h1><a href="index.html">WEB</a></h1>
<ol>
<li><a href="1.html">HTML</a></li>
<li><a href="2.html"style="color:red;text-decoration:underline">CSS</a></li>
<li><a href="3.html">JavsScript</a></li>
</ol>
-web
์ ํ์, ์ ์ธ, ์์ฑ, ์์ฑ๊ฐ
:๊ฒ์ ํค์๋๋ css text size/middle property
<style>
a{
color: black;
text-decoration: none;
}
h1{
font-size:45px;
text-align: center;
}
</style>
<style>
a{
color:black;
text-decoration: none;
}
.saw{
color: gray;
}
h1{
font-size:45px;
text-align: center;
}
</style>
</head>
<body>
<h1><a href="index.html">WEB</a></h1>
<ol>
<li><a href="1.html"class="saw">HTML</a></li>
<li><a href="2.html"class="saw">CSS</a></li>
<li><a href="3.html">JavsScript</a></li>
</ol>
-web
:ํด๋์ค๋ผ๋ ์์ฑ์ ๊ฐ์ ์ฌ๋ฌ๊ฐ์ ๊ฐ์ด ๋ค์ด์ฌ ์ ์๊ณ ๋์ด์ฐ๊ธฐ๋ก ๊ตฌ๋ถํ๋ค
<style>
a{
color:black;
text-decoration: none;
}
.saw{
color: gray;
}
.active{
color: red;
}
h1{
font-size:45px;
text-align: center;
}
</style>
</head>
<body>
<h1><a href="index.html">WEB</a></h1>
<ol>
<li><a href="1.html"class="saw">HTML</a></li>
<li><a href="2.html"class="saw active">CSS</a></li>
<li><a href="3.html">JavsScript</a></li>
</ol>
<style>
a{
color:black;
text-decoration: none;
}
#active{
color: red;
}
.saw{
color: gray;
}
h1{
font-size:45px;
text-align: center;
}
</style>
</head>
<body>
<h1><a href="index.html">WEB</a></h1>
<ol>
<li><a href="1.html"class="saw">HTML</a></li>
<li><a href="2.html"class="saw"id="active">CSS</a></li>
<li><a href="3.html">JavsScript</a></li>
</ol>
-web
: ex) h1,ol
-code
-web
:ex) a
-web
-web
์์ ๊ธฐ ์ ์ฝ๋
์์ค ํ ์ฝ๋
<style>
h1{
border: 5px red solid;
padding: 20px;
}
</style>
</head>
<body>
<h1>CSS</h1>
</body>
-web
<style>
h1{
border: 5px red solid;
padding: 20px;
margin:0;
}
</style>
</head>
<body>
<h1>CSS</h1>
<h1>CSS</h1>
-web
-code
<style>
h1{
border: 5px red solid;
padding: 20px;
margin: 20px;;
}
</style>
</head>
<body>
<h1>CSS</h1>
<h1>CSS</h1>
-web
<style>
h1{
border: 5px red solid;
padding: 20px;
margin: 20px;
display: block;
width: 100px;
}
</style>
</head>
<body>
<h1>CSS</h1>
<h1>CSS</h1>
-code
h1{
font-size:45px;
text-align: center;
border-bottom:1px solid gray;
}
</style>
</head>
<body>
<h1><a href="index.html">WEB</a></h1>
<ol>
<li><a href="1.html"class="saw">HTML</a></li>
<li><a href="2.html"class="saw"id="active">CSS</a></li>
<li><a href="3.html">JavsScript</a></li>
</ol>
-code
h1{
font-size:45px;
text-align: center;
border-bottom:1px solid gray;
margin: 0;
}
</style>
</head>
<body>
<h1><a href="index.html">WEB</a></h1>
<ol>
<li><a href="1.html"class="saw">HTML</a></li>
<li><a href="2.html"class="saw"id="active">CSS</a></li>
<li><a href="3.html">JavsScript</a></li>
</ol>
-web: ์์ ๊ธฐ ์ (์ฃผํฉ์์ด ๋ง์ง)
border right์ผ๋ก ์ค๋ฅธ์ชฝ์ ์ค ๊ธ๊ธฐ, ol์ block element์ด๋ฏ๋ก ๋๋นํฌ๊ธฐ ์กฐ์ ํด์ ๊ทธ์.
-code
h1{
font-size:45px;
text-align: center;
border-bottom:1px solid gray;
margin: 0;
padding: 20px;
}
ol{
border-right: 1px solid gray;
width: 100px;
}
</style>
</head>
<body>
<h1><a href="index.html">WEB</a></h1>
<ol>
<li><a href="1.html"class="saw">HTML</a></li>
<li><a href="2.html"class="saw"id="active">CSS</a></li>
<li><a href="3.html">JavsScript</a></li>
</ol>
-web
div
์๋ฌด ๊ธฐ๋ฅ๋ ์๋ ํ๊ทธ. ๋ ์ด์์์ ๋๋๋๋ฐ ์ฐ์ธ๋ค.
block level element์ด๋ฏ๋ก ์ค๋ฐ๊ฟ์ด ๋๋ค.
span
div ํ๊ทธ์ฒ๋ผ ์๋ฌด ๊ธฐ๋ฅ๋ ์๋ ํ๊ทธ. ๋ ์ด์์์ ๋๋๋๋ฐ ์ฐ์ธ๋ค.
inline level element ์ด๋ค.
์ฒซ ๋ฒ์งธ(NAVIGATION)๋ 150px, ๋ ๋ฒ์งธ(ARTICLE)๋ ๋๋จธ์ง ์ ์ฒด๋ฅผ ์ฐ๊ฒ ํ๋ค
-code
<style>
#grid{
border:5px solid pink;
display: grid;
grid-template-columns: 150px 1fr;
}
div{
border:5px solid gray;
}
</style>
</head>
<body>
<div id="grid">
<div>NAVIGATION</div>
<div>ARTICLE</div>
</div>
</body>
-web
h1{
font-size:45px;
text-align: center;
border-bottom:1px solid gray;
margin: 0;
padding: 20px;
}
ol{
border-right: 1px solid gray;
width: 100px;
margin:0;
padding: 20px;
}
#grid{
display: grid;
grid-template-columns: 150px 1fr;
}
</style>
</head>
<body>
<h1><a href="index.html">WEB</a></h1>
<div id="grid">
<ol>
<li><a href="1.html"class="saw">HTML</a></li>
<li><a href="2.html"class="saw"id="active">CSS</a></li>
<li><a href="3.html">JavsScript</a></li>
</ol>
<div>
<h2>CSS</h2>
<p>Cascading Style Sheets (CSS) is a style sheet language used for describing the presentation of a document written in a markup language such as HTML or XML (including XML dialects such as SVG, MathML or XHTML). CSS is a cornerstone technology of the World Wide Web, alongside HTML and JavaScript.</p>
</div>
</div>
#grid{
display: grid;
grid-template-columns: 150px 1fr;
}
#grid ol{
padding-left: 32px;
}
#article{
padding-left: 25px;
}
</style>
</head>
<body>
<h1><a href="index.html">WEB</a></h1>
<div id="grid">
<ol>
<li><a href="1.html">HTML</a></li>
<li><a href="2.html"id="active">CSS</a></li>
<li><a href="3.html">JavsScript</a></li>
</ol>
<div id="article">
<h2>CSS</h2>
<p>Cascading Style Sheets (CSS) is a style sheet language used for describing the presentation of a document written in a markup language such as HTML or XML (including XML dialects such as SVG, MathML or XHTML). CSS is a cornerstone technology of the World Wide Web, alongside HTML and JavaScript.</p>
</div>
</div>
</body>
:800ํฝ์ ๋ณด๋ค ํฌ๋ฉด ์ฌ๋ผ์ง๊ฒ ํ๊ธฐ
<style>
div{
border: 5px solid green;
font-size: 60px;
}
@media(min-width:800px)
{
div{
display:none;
}
}
</style>
</head>
<body>
<div>
Responsive
</div>
</body>
: 1. 800ํฝ์
๋ณด๋ค ํ๋ฉด์ ํฌ๊ธฐ๊ฐ ์์ ๋ id๊ฐ์ด grid์ธ ํ๊ทธ์ display๊ฐ grid์๋ ๊ฒ์ด block์ผ๋ก ๋ฐ๋๋ค.
2. 800ํฝ์
๋ณด๋ค ํ๋ฉด์ ํฌ๊ธฐ๊ฐ ์์ ๋ ol ํ๊ทธ์ ์ค๋ฅธ์ชฝ ๊ฒฝ๊ณ๊ฐ ์ฌ๋ผ์ง๋ค.
3. h1ํ๊ทธ์ ์๋ ๊ฒฝ๊ณ๊ฐ ์ฌ๋ผ์ง๋ค.
<link rel="stylesheet" href="style.css">
๋ฅผ ์ ๋ ฅํ๋ค.
body{
margin:0;
}
a {
color:black;
text-decoration: none;
}
h1 {
font-size:45px;
text-align: center;
border-bottom:1px solid gray;
margin:0;
padding:20px;
}
ol{
border-right:1px solid gray;
width:100px;
margin:0;
padding:20px;
}
#grid{
display: grid;
grid-template-columns: 150px 1fr;
}
#grid ol{
padding-left:33px;
}
#grid #article{
padding-left:25px;
}
@media(max-width:800px){
#grid{
display: block;
}
ol{
border-right:none;
}
h1 {
border-bottom:none;
}
}
<!doctype html>
<html>
<head>
<title>WEB - HTML</title>
<meta charset="utf-8">
<link rel="stylesheet" href="style.css">
</head>
<body>
โกโงใยฐโยทหโโกโ CSS หโงโยฐใโงโก โงใยฐโ
<style></style>: html์ TAG, "style ์์ชฝ์ ๋ด์ฉ์ CSS์ด๋๊น ๋๋ ์ด๊ฒ์ CSS์ ๋ฌธ๋ฒ์ ๋ง๊ฒ ํด์ํด์ผ ํด"
a{ color: red;}: "์น ๋ธ๋ผ์ฐ์ ์ผ, ์ด ์นํ์ด์ง์ ์๋ ๋ชจ๋ a TAG์ ๋ํด์ ํฐํธ ์ปฌ๋ฌ๋ฅผ ๋นจ๊ฐ์์ผ๋ก ๋ง๋ค์ด์ค"
<a href="2.html" style="color:red">CSS</a>: CSS๊ธ์๋ง ๋นจ๊ฐ์์ผ๋ก ํ๊ธฐ. html๋ถ๋ถ์ ์์ผ๋ฏ๋ก CSS ์์ ์๋ ค์ฃผ๊ธฐ ์ํด style=""๋ฅผ ์ฌ์ฉ.
text-decoration: none; : ํด๋น ์นํ์ด์ง์ ์๋ ๋ชจ๋ ์ง์ ์์ฑ(a)์ ๋ํด ๋ฐ์ค์ด ์์ด์ง
<a href="2.html" style="color:red; text-decoration:underline">CSS</a>
->CSS์๋ง ๋ฐ์ค ์๊น
h1{
font-size: 45px;
text-align: center;
}
->์์ฑ h1์ ํฐํธํฌ๊ธฐ๋ฅผ 45ํฝ์
, ๊ฐ์ด๋ฐ ์ ๋ ฌ.
<a href="1.html" class="saw">
saw๋ผ๋ ํด๋์ค์ ๊ฐ์ ๊ฐ์ง tag๋ฅผ ๋ง๋ฌ.
.saw{
color:gray;
}
ํด๋์ค๊ฐ์ด saw์ธ tag๋ฅผ ๊ฐ๋ฆฌํค๋ ์ ํ์
<a href="2.html" class="saw active">
: ํด๋์ค๋ผ๋ ์์ฑ์ ๊ฐ์ ์ฌ๋ฌ๊ฐ์ ๊ฐ์ด ๋ค์ด์ฌ ์ ์๊ณ ๋์ด์ฐ๊ธฐ๋ก ๊ตฌ๋ถํ๋ค
<a href="2.html" class="saw" id="active">
->id์ ํ์์ class์ ํ์๊ฐ ๋ถ์ผ๋ฉด id๊ฐ ์ฐ์ ์์.
class์ ํ์์ tag์ ํ์a{}๊ฐ ๋ถ์ผ๋ฉด ํด๋์ค๊ฐ ์ด๊น.
์ ๋ถ ๋ค ๊ฐ์ ์ ํ์: ๊ฐ์ฅ ๋ง์ง๋ง ๋ฑ์ฅ ์ ํ์๊ฐ ์ฐ์ ์์.
=>id>class>tag
mediaquery:
์ด๋ ํ ์กฐ๊ฑด์ ๋ง์กฑํ ๋๋ง css์ ๋ด์ฉ์ด ๋์ํ๋๋ก ํ๊ฒ ํ๋ ๊ฒ.
ex)
@media(min-width:800px){
div{
display:none;
}
}
-> ํ๋ฉด์ ๋๋น๊ฐ800px์ด์์ด๋ฉด ์์ฑ div์display๋ฅผ none๋ก ํ๋ค (์ฆ 800px์ด์ ํ๋ฉด์ด ๋์ด๋๋ฉด div๋ก ๊ฐ์ผ ์ ๋ณด๊ฐ ์์ด์ง. (@media(max-width:800px)๋ ๊ฐ๋ฅ)
@media(max-width:800px){
#grid{
display: block;
}
}
800px๋ณด๋ค ํ๋ฉด์ ํฌ๊ธฐ๊ฐ ์์ ๋ id๊ฐ์ด grid์ธ tag์ display๊ฐ gird์์ block์ผ๋ก ๋ฐ๋.