CSS๋?
์คํ์ผ์ HTML ๋ฌธ์ ๋ด์ ์์ฒด์ ์ข ๋ฅ,ํฌ๊ธฐ,์, ์ฌ๋ฐฑ๋ฑ์
์ง์ ํ์ฌ ์ฌ์ฉ์์ web browser ํ๊ฒฝ์ ์๊ด์์ด ์ผ์ ํ ํ๋ฉด์ ๋ณด์ฌ์ฃผ๋ ๊ธฐ๋ฅ.
CSS ์ง์ ๋ฐฉ๋ฒ
- ์ธ๋ผ์ธ ์คํ์ผ : inline Style์ HTML tag ์์ style ์์ฑ์ ์ฌ์ฉํ์ฌ ์ง์ ์ง์ ํ๋ค.
- ๋ด๋ถ ์คํ์ผ ์ํธ : ์คํ์ผ ์ํธ์ ๊ธฐ๋ณธ์ ์ธ ์ฌ์ฉ ๋ฐฉ๋ฒ์ผ๋ก html์ <head>~</head> ์ฌ์ด์ ์ฝ์ ํ์ฌ <style type="css/text" media="๊ฐ">...<style>
- ์ธ๋ถ ์คํ์ผ ์ํธ
- imported style sheet : ์ด๋ฐฉ์์ ๊ฒฐ๊ณผ์ ์ผ๋ก linked style์ ๊ฐ๊ณ ์์น๋ embedded ๋ฐฉ์๊ณผ ๋ง์ฐฌ ๊ฐ์ง๋ก style block ์์ ๋ค์ด๊ฐ๋ค.
ํฌ๊ธฐ ๋จ์
- px : ํฝ์ ์ ๋๋ฐ์ด์ค ํด์๋์ ๋ฐ๋ผ ์๋์ ์ธ ํฌ๊ธฐ๋ฅผ ๊ฐ๋๋ค. ๋๋ฐ์ด์ค์ ๋ฐ๋ผ ํฝ์ (ํ์)์ ํฌ๊ธฐ๋ ๋ค๋ฅด๊ธฐ ๋๋ฌธ์ ํฝ์ ์ ๊ธฐ์ค์ผ๋ก ํ๋ ๋จ์๋ ๋ช ํํ์ง ์๋ค.
- % : ๋ฐฑ๋ถ๋ฅ ๋จ์์ ์๋ ๋จ์. ์์์ ์ง์ ๋ ์ฌ์ด์ฆ(์์๋ ์ฌ์ด์ฆ๋ ๋ํดํธ ์ฌ์ด์ฆ)์ ์๋์ ์ธ ์ฌ์ด์ฆ๋ฅผ ์ค์ ํ๋ค.
- em : ๋ฐฐ์ ๋จ์ ์๋ ๋จ์. ์์ ์ง์ ๋ ์ฌ์ด์ฆ๋ฅผ ์ค์ ํ๋ค.
- rem : root em ์ด๋ผ๋ ๋ป์ผ๋ก, HTML ๋ฌธ์์ root ์์์ธ <html>์ ๊ฐ๋ฆฌํค๋ฉฐ, ์ด ์์์ ์ง์ ๋ ํฌ๊ธฐ๋ฅผ ๊ธฐ์ค์ผ๋ก ์๋์ ์ธ ๊ฐ์ ๊ฐ์ง๊ฒ ๋๋ค.
- Viewport ๋จ์ : ๋ฐ์ํ ์น์ ํ๋ฉด์ ํฌ๊ธฐ์ ๋์ ์ผ๋ก ๋์ํ๊ธฐ ์ํด % ๋จ์๋ฅผ ์์ฃผ ์ฌ์ฉํ์ง๋ง, % ๋จ์๋ em๊ณผ ๊ฐ์ด ์์์ ์ํด ๋ถ๋ชจ ์์์ ์๋์ ์ํฅ์ ๋ฐ๋๋ค. Viemport ๋จ์๋ ์๋์ ์ธ ๋จ์๋ก viewport๋ฅผ ๊ธฐ์ค์ผ๋ก ํ ์๋์ ์ฌ์ด์ฆ๋ฅผ ์๋ฏธํ๋ค.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style type="text/css">
.box{
width: 350px; height: 200px;
border: 3px dotted gray;
font-size: 14px;
font-weight: bold;
text-align: center;
padding: 2em;
/* 2em = 2 x ๊ธ์ํฌ๊ธฐ = 2x14 = 28px*/
}
</style>
</head>
<body>
<h3> ๋จ์(Units) : px </h3>
<div class="box">๊ธ์ํฌ๊ธฐ: 14px</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style type="text/css">
body{
font-size: 14px;
}
.box{
width: 350px; height: 200px;
border: 3px dotted gray;
font-size: 120%; /*๋ถ๋ชจํฌ๊ธฐx120%=14*1.2=16.8px*/
font-weight: bold;
text-align: center;
padding: 2em /*16.8px*2=33.6px*/;
}
</style>
</head>
<body>
<h3> ๋จ์(Units) : % </h3>
<div class="box">๊ธ์ํฌ๊ธฐ: 14px * 120% = 16.8px</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style type="text/css">
body{
font-size: 14px;
}
.box{
width: 350px; height: 200px;
border: 3px dotted gray;
font-size: 1.2em; /*๋ถ๋ชจํฌ๊ธฐx1.2=14*1.2=16.8px*/
font-weight: bold;
text-align: center;
padding: 2em
/*๊ธ์ํฌ๊ธฐ*2=16.8x2=33.6px ํจ๋ฉ์ ๊ธ์ํฌ๊ธฐ๋ฅผ ๋ฐ๋ผ๊ฐ๊ณ , ๊ธ์๋ ๋ถ๋ชจํฌ๊ธฐ๋ฅผ ๋ฐ๋ผ๊ฐ*/;
}
</style>
</head>
<body>
<h3> ๋จ์(Units) : em </h3>
<div class="box">๊ธ์ํฌ๊ธฐ: 1.2em = 14px * 1.2 = 16.8px</div>
</body>
</html>
ํ๋กํผํฐ
- inherit : ์ธํค๋ฆฟ ํค์๋๋ฅผ ์ฌ์ฉํ ์์ฑ์ ๋ถ๋ชจ ์์๋ก๋ถํฐ ํด๋น ์์ฑ์ ๊ณ์ฐ ๊ฐ์ ์์ ๋ฐ์ ์ฌ์ฉํ๋ค. all ๋จ์ถ ์์ฑ์ ํฌํจํ ๋ชจ๋ ์์ฑ์ ์ฌ์ฉํ ์ ์๋ค.
- initial : ์์ฑ์ ์ด๊ธฐ๊ฐ(๊ธฐ๋ณธ๊ฐ)์ ์์์ ์ ์ฉํ๋ค. ์ด๊ธฐ๊ฐ์ ๋ธ๋ผ์ฐ์ ๊ฐ ์ง์ ํ๋ค. ๋ชจ๋ ์์ฑ์์ ์ฌ์ฉํ ์ ์์ผ๋ฉฐ, all์ ์ง์ ํ ๊ฒฝ์ฐ ๋ชจ๋ CSS ์์ฑ์ ์ด๊ธฐ๊ฐ์ผ๋ก ์ฌ์ค์ ํ๋ค.
- uri : uri๋ url (์ฃผ์)+urm (์์์ด๋ฆ)๋ก, ์น ์์์ ๋ฌธ์์ ๋ฐฐ๊ฒฝ ๊ทธ๋ฆผ์ด๋ ์์๊ฐ ์๋ list์์ icon์ ๋ฃ์๋ url์ด๋ uri๋ฅผ ๊ธฐ์ ํ๋ค.
- !important : ๋ชจ๋ style ๊ท์น์ ์ฐ์ ํ๋ฉฐ inline style,id selector,class selector๋ค๋ก ๊ฐ์ style ์์ฑ์ ์ ์ธํ๋๋ผ๋ ๊ทธ ๊ฐ์ ๋ชจ๋ ๋ฌด์ํ๋ฉฐ !import ์ ์ธํ ์์ฑ ๊ฐ์ ์ ์ฉ์ํจ๋ค.
์์
์์(๋ถ๋ชจ,์กฐ์)์์์ ์ ์ฉ๋ ํ๋กํผํฐ๋ฅผ ํ์(์์,์์)์์๊ฐ ๋ฌผ๋ ค ๋ฐ๋ ๊ฒ์ ์๋ฏธํ๋ค. ํ๋กํผํฐ์๋ ์์์ด ๋๋ ๊ฒ๊ณผ ๋์ง ์๋ ๊ฒ์ด ์๋ค.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style type="text/css">
.text-red{
color: red;
border: 1px solid #bcbcbc;
padding: 10px;
}
</style>
</head>
<body>
<h3> ์์(Inheritance) </h3>
<div class="text-red">
<h1>์์ ์</h1>
<p>๋ฌธ๋จ <span>span</span></p>
<button>๋ฒํผ 1</button>
<button style="color: inherit;">๋ฒํผ 2</button> <!-- ์ธํค๋ฆฟ ํค์๋๋ก ๋ถ๋ชจ์์ฑ ์์ -->
</div>
<hr>
<div>
<p> color๋ ํ์ ์์์ ์์๋๋ ์์ฑ์ด์ง๋ง button ํ๊ทธ ์ฒ๋ผ ์์์ ๋ฐ๋ผ ์์ ๋ฐ์ง ์๋ ๊ฒฝ์ฐ๋ ์กด์ฌ </p>
<p>
<b>์์๋๋ ์์ฑ</b>
<br>visibility, opacity, font, color, line-height, text-align, white-space ๋ฑ
</p>
<hr>
<p>
<b>์์๋๋ ์๋ ์์ฑ</b>
<br>width, height, margin, padding, border, box-sizing, display, background, vertical-align,
text-decoration, position, top/right/bottom/left, z-index,
overflow, float ๋ฑ
</p>
</div>
</body>
</html>
์บ์ค์บ์ด๋ฉ
์์๋ ํ๋ ์ด์์ CSS์ ์ธ์ ์ํฅ์ ๋ฐ์ ์ ์๋ค. ์ด๋ ์ถฉ๋์ ํผํ๊ธฐ ์ํด CSS์ ์ฉ ์ฐ์ ์์๊ฐ ํ์ํ๋ฐ ์ด๋ฅผ ์บ์ค์บ์ด๋ฉ์ด๋ผ๊ณ ํ๋ค. ์บ์ค์บ์ด๋ฉ ์ธ๊ฐ์ง ๊ท์น ์ค์๋(CSS๊ฐ ์ด๋์ ์ ์ธ ๋์ด์๋์ง์ ๋ฐ๋ผ์ ์ฐ์ ์์๊ฐ ๋ฌ๋ผ์ง๋ค.) ๋ช ์๋(๋์์ ๋ช ํํ๊ฒ ํน์ ํ ์๋ก ๋ช ์๋๊ฐ ๋์์ง๊ณ ์ฐ์ ์์๊ฐ ๋์์ง๋ค.) ์ ์ธ์์ (์ ์ธ๋ ์์์ ๋ฐ๋ผ ์ฐ์ ์์๊ฐ ์ ์ฉ๋๋ค. ์ฆ, ๋์ค์ ์ ์ธ๋ ์คํ์ผ์ด ์ฐ์ ์ ์ฉ๋๋ค).
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<link rel="stylesheet" href="style3.css">
<style type="text/css">
div{
background: navy;
}
</style>
</head>
<body>
<h3> Cascading Order </h3>
<div>
CSS๊ฐ ์ด๋์ ์ ์ธ ๋์๋์ง์ ๋ฐ๋ผ์ ์ฐ์ ์์๊ฐ ๋ฌ๋ผ์ง๋ค.
</div>
<p>
1) embedded style sheet : style ์์<br>
2) embedded style sheet ๋ด์ @import ๋ฌธ<br>
3) linked style sheet : link ํ๊ทธ๋ก ์ฐ๊ฒฐ๋ CSS ํ์ผ<br>
4) linked style sheet ๋ด์ @import ๋ฌธ<br>
5) ๋ธ๋ผ์ฐ์ ๋ํดํธ ์คํ์ผ์ํธ<br>
</p>
</body>
</html>
์ ํ์(Select)๋?
์ ํ์๋ style์ ์ ์ฉํ๊ณ ์ ํ๋ HTML ์์๋ก, ์ํ๋ ์์๋ฅผ ์ ํํ๋๋ฐ
์ฌ์ฉ๋๋ ํจํด์ด๋ค. ์ฆ, style์ ์ ์ฉํ๊ณ ์ ํ๋ HTML ์์๋ฅผ
์ ๋ ํฐ๋ก ํน์ ํ๊ณ ์ ํ๋ ์์์ ์คํ์ผ์ ์ ์ํ๋ค.๊ตฌ๋ฌธํ์
Selector
- ์ ์ฒด ์ ๋ ํฐ(*) : HTML ๋ฌธ์ ๋ด์ ๋ชจ๋ ์์๋ฅผ ์ ํํ๋ค. html ์์๋ฅผ ํฌํจํ ๋ชจ๋ ์์๊ฐ ์ ํ๋๋ค.
- ํ๊ทธ ์ ๋ ํฐ : ์ง์ ๋ ํ๊ทธ๋ช ์ ๊ฐ์ง๋ ์์๋ฅผ ์ ํํ๋ค.
- ID ์ ๋ ํฐ : id ์ดํธ๋ฆฌ๋ทฐํธ ๊ฐ์ ์ง์ ํ์ฌ ์ผ์นํ๋ ์์๋ฅผ ์ ํํ๋ค. id ์ดํธ๋ฆฌ๋ทฐํธ ๊ฐ์ ์ค๋ณต๋ ์ ์๋ ์ ์ผํ ๊ฐ์ด๋ค.
- ํด๋์ค ์ ๋ ํฐ : class ์ดํธ๋ฆฌ๋ทฐํธ ๊ฐ์ ์ง์ ํ์ฌ ์ผ์นํ๋ ์์๋ฅผ ์ ํํ๋ค.
- ์ดํธ๋ฆฌ๋ทฐํธ ์ ๋ ํฐ : ์ฃผ์ด์ง ์ดํธ๋ฆฌ๋ทฐํธ์ ์กด์ฌ์ฌ๋ถ๋ ๊ทธ ๊ฐ์ ๋ฐ๋ผ ์์๋ฅผ ์ ํํ๋ค.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style type="text/css">
/*๋ชจ๋ ์์*/
*{
font-size: 15px;
font-family: "๋ง์ ๊ณ ๋",๋์,sans-serif;
}
/*ํ๊ทธ ์ ํ์*/
p{background: yellow;}
label {color: blue;font-weight: bold;}
/*id ์ ํ์*/
#box{
width: 300px;
padding: 10px;
border: 3px dashed gray;
}
/*ํด๋์ค ์ ํ์*/
.red{color: red;}
.underline{text-decoration: underline;}
</style>
</head>
<body>
<h3>Selector : ๊ธฐ๋ณธ ์
๋ ํฐ</h3>
<div>
<div id="box">
<label>ํ๋ก๊ทธ๋๋ฐ</label>
<span class="red">์๋ฐ</span>
<span>C์ธ์ด</span>
<span class="red underline">์ฝํ๋ฆฐ</span>
<p>
<label>๋ฐ์ดํฐ๋ฒ ์ด์ค</label>
<span class="red">์ค๋ผํด</span>
<span class="underline">mysql</span>
<span>๋น
๋ฐ์ดํฐ</span>
</p>
</div>
<div>
<label>์น</label>
<span>HTML</span>
<span>CSS</span>
<span>javascript</span>
<p>
<label>์นํ๋ก๊ทธ๋จ</label>
<span>JSP</span>
<span>PHP</span>
<span>ASP.NET</span>
</p>
</div>
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style type="text/css">
.box{
color: tomato;
}
div.box{
width: 300px; height: 50px; border: 3px dotted gray;
}
/*OR*/
lable,span{color: blue; font-weight: bold;}
</style>
</head>
<body>
<h3>๋ค์ค ์กฐ๊ฑด ์ ํ์</h3>
<p class="box">
AND ์ฐ์ฐ ์ ํ์ :๋ชจ๋ ์กฐ๊ฑด์ ๋ง์กฑํ๋ ์์ ์ ํ. ์ ํ์๋ผ๋ฆฌ ๋์ด์ฐ๊ธฐ ์์ด ๋ถ์ฌ ์ด๋ค.
</p>
<br>
<div class="box"></div>
<br>
<div><p class="box">์์ </p></div>
<hr>
<p>
์ ํ์(Selector) ๋ชฉ๋ก(OR ์ฐ์ฐ) : ์ ํ์ ๋ชฉ๋ก(,)์ ์ผ์นํ๋ ๋ชจ๋ ์์๋ฅผ ์ ํ
</p>
<div>
<p>๊ณผ๋ชฉ</p>
<label>์น</label>
<span>HTML</span>
<span>CSS</span>
<span>์๋ฐ์คํฌ๋ฆฝํธ</span>
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style type="text/css">
p{height: 20px;}
/* name=subject ์ธ ์์ */
input[name=subject]{
background: yellow;
}
/* name ์์ฑ์ด ์กด์ฌํ๋ ์์ */
input[name]{
border: 1px solid blue;
}
/*name์ด a๋ก ์์ํ๋ ์์*/
input[name^=a]{border-right:3px solid red; }
/*title์ด ๋ฒํผ์ผ๋ก ๋๋๋ ์์, "๋ฒํผ"์ฒ๋ผ ํด๋ ๊ฐ๋ฅ*/
input[title$=๋ฒํผ]{background: green;}
/*name์ด x๊ฐ ํฌํจ๋ ์์*/
input[name*=x]{border-left:3px solid orange; }
/*title์ ๋ด์ฉ์ด๋ผ๋ ๋จ์ด(๋์ด์ฐ๊ธฐ๋ก๊ตฌ๋ถ)๊ฐ ์กด์ฌํ๋ ์์*/
input[title~=๋ด์ฉ]{background: gray;}
/* p์์์ค lang๊ฐ en ์ด๊ฑฐ๋ en-๋ก ์์ํ๋ ์์ */
p[lang|=en]{
color: red;
}
</style>
</head>
<body>
<h3>์ดํธ๋ฆฌ๋ทฐํธ ์
๋ ํฐ(Attribute Selector) : ์ฃผ์ด์ง ์ดํธ๋ฆฌ๋ทฐํธ์ ์กด์ฌ์ฌ๋ถ๋ ๊ทธ ๊ฐ์ ๋ฐ๋ผ ์์๋ฅผ ์ ํ</h3>
<form>
<p> <input type="text" name="subject" title="๊ณผ๋ชฉ ์
๋ ฅ"> </p>
<p> <input type="text" name="ax1" title="1์ฅ ์ ๋ชฉ ์
๋ ฅ"> </p>
<p> <input type="text" name="as2" title="1์ฅ ๋ด์ฉ ์
๋ ฅ"> </p>
<p> <input type="text" name="bs1" title="2์ฅ ์ ๋ชฉ ์
๋ ฅ"> </p>
<p> <input type="text" name="bx2" title="2์ฅ ๋ด์ฉ ์
๋ ฅ"> </p>
<p> <input type="file" name="selectFile"> </p>
<p>
<input type="button" value="์
๋ ฅ์๋ฃ" title="์
๋ ฅ ๋ฒํผ">
<input type="reset" value="์
๋ ฅ์ทจ์" title="์ทจ์ ๋ฒํผ">
</p>
</form>
<div style="margin-top: 30px;">
<p lang="en">JAVA</p>
<p lang="en-us">JAVA</p>
<p lang="en-gb">JAVA</p>
<p lang="us">JAVA</p>
<p lang="no">JAVA</p>
</div>
</body>
</html>
๊ฒฐํฉ์
- ์ธ์ ํ์ ๊ฒฐํฉ์ ; ์ธ์ ํ์ ๊ฒฐํฉ์(+)๋ ์์์ ์ง์ ํ ์์์ ๋ฐ๋ก ๋ค์์ ์์นํ๋ ํ์ ์์๋ง ์ ํํ๋ค.
- ์ผ๋ฐ ํ์ ๊ฒฐํฉ์ : ์ผ๋ฐ ํ์ ๊ฒฐํฉ์(~)๋ ๋๊ฐ์ ์ ํ์ ์ฌ์ด์ ์์นํ์ฌ ๋ค์ชฝ ์ ํ์์ ์์์ ์์ชฝ ์ ํ์ ์์์ ๋ถ๋ชจ ์์๊ฐ ๊ฐ๊ณ , ๋ค์ชฝ ์ ํ์์ ์์๊ฐ ๋ค์ ์์นํ ๋ ์ ํํ๋ค.
- ์์ ๊ฒฐํฉ์ : ์์ ๊ฒฐํฉ์(>)๋ ๋ ๊ฐ์ CSS ์ ํ์ ์ฌ์ด์ ์์นํ์ฌ ๋ค์ชฝ ์ ํ์์ ์์๊ฐ ์์ชฝ ์ ํ์ ์์์ ๋ฐ๋ก ๋ฐ์ ์์นํ ๊ฒฝ์ฐ์๋ง ์ ํํ๋ค.
- ์์(ํ์)๊ฒฐํฉ์ : ๋ณดํต ํ ์นธ์ ๊ณต๋ฐฑ ๋ฌธ์๋ก ํํํ๋ ์์ ๊ฒฐํฉ์()๋ ๋๊ฐ์ ์ ํ์๋ฅผ ์กฐํฉํ์ฌ, ๋ค์ชฝ ์ ํ์ ์์์ ์กฐ์์ ์์ชฝ ์ ํ์ ์์๊ฐ ์กด์ฌํ ๊ฒฝ์ฐ ์ ํํ๋ค.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style type="text/css">
/*์ธ์ ํ์ ๊ฒฐํฉ์(+)*/
label+span{
background: yellow;
}
/*์ผ๋ฐ ํ์ ๊ฒฐํฉ์(~)*/
label~span{
color: blue; font-weight: bold;
}
/*์์ ๊ฒฐํฉ์(>)*/
.subject>lable{
color: tomato;
font-weight: bold;
}
/*์์ ๊ฒฐํฉ์(๊ณต๋ฐฑ)*/
.subject lable{
background: #ccc;
}
</style>
</head>
<body>
<h3>Selector : ๊ฒฐํฉ์(Combinator)</h3>
<div class="box">
<div class="subject">
<label>ํ๋ก๊ทธ๋๋ฐ</label>
<span>์๋ฐ</span>
<span>C์ธ์ด</span>
<span>์ฝํ๋ฆฐ</span>
<p>
<label>๋ฐ์ดํฐ๋ฒ ์ด์ค</label>
<span>์ค๋ผํด</span>
<span>mysql</span>
<span>๋น
๋ฐ์ดํฐ</span>
</p>
</div>
<div class="subject">
<label>์น</label>
<span>HTML</span>
<span>CSS</span>
<span>javascript</span>
<p>
<label>์นํ๋ก๊ทธ๋จ</label>
<span>JSP</span>
<span>PHP</span>
<span>ASP.NET</span>
</p>
</div>
</div>
<div>
<span>End...</span>
</div>
</body>
</html>
๊ฐ์ ํด๋์ค
์ ํ์์ ์ถ๊ฐํ๋ ํค์๋๋ก, ์ ํํ ์์๊ฐ ํน๋ณํ ์ํ์ฌ์ฌ์ผ ๋ง์กฑํ ์ ์๋ค. ex) ๋ง์ฐ์ค๊ฐ ์ฌ๋ผ์ ์์ ๋์๋ง ๊ธ์จ ์์ ๋ฐ๊พธ๊ณ ์ถ์๋. ๋งํฌ๋ฅผ ๋ฐฉ๋ฌธํ์ ๋์ ์์ง ๋ฐฉ๋ฌธํ์ง ์์์๋
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style type="text/css">
/*๋ฐฉ๋ฌธํ์ง ์์ ๋งํฌ์ผ ๋*/
a:link{color: orange;}
/*๋ฐฉ๋ฌธํ ๋งํฌ์ผ ๋ */
a:visited {color: green;}
/*๋ง์ฐ์ค๋ฅผ ์ฌ๋ ค๋์ ๋*/
a:hover {color: maroon;}
/*ํด๋ฆญ๋ ์ํ*/
a:active {color: blue;}
/*ํฌ์ปค์ค๋ฅผ ๋ฐ์๋*/
input[type=text]:focus,input[type=password]:focus{
outline: none;
border: 1px solid red;
}
</style>
</head>
<body>
<h3>๊ฐ์ ํด๋์ค(Pseudo-classes) : ๋งํฌ ์
๋ ํฐ(Link pseudo-classes) </h3>
<div>
<a href="#">๋งํฌ</a> |
<a href="https://google.com">๊ตฌ๊ธ</a>
</div>
<div>
<p> <input type="text"> </p>
<p> <input type="password"> </p>
<p> <input type="button" value="ํ์ธ"> </p>
</div>
</body>
</html>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<style type="text/css">
input:enabled+span{
color: blue;
}
input:disabled{color: tomato;}
input:checked+span{color: red;}
</style>
</head>
<body>
<h3>๊ฐ์ ํด๋์ค(Pseudo-classes) : UI ์์ ์ํ ์
๋ ํฐ </h3>
<div>
<p> <input type="text" value="default"> <span>default</span> </p>
<p> <input type="text" readonly value="readonly"> <span>readonly</span> </p>
<p> <input type="text" disabled value="disabled"> <span>disabled</span></p>
<p> <input type="checkbox"> <span>์ ํ1</span> </p>
<p> <input type="checkbox" checked> <span>์ ํ2</span> </p>
<p> <input type="button" value="ํ์ธ"> </p>
</div>
</body>
</html>
'๐ป > CSS' ์นดํ ๊ณ ๋ฆฌ์ ๋ค๋ฅธ ๊ธ
(45) [CSS] 3์ผ ๋ฐ์ํ ์น(Responsive Web) (1) | 2024.04.18 |
---|---|
(45) [CSS] 3์ผ ๋ ์ด์์๊ณผ ํฌ์ง์ ๋ - Grid (0) | 2024.04.18 |
(44) [CSS] 2์ผ ๋ ์ด์์๊ณผ ํฌ์ง์ ๋ - flex (0) | 2024.04.17 |
(44) [CSS] 2์ผ ๋ ์ด์์๊ณผ ํฌ์ง์ ๋ (0) | 2024.04.17 |
(43) [CSS] 1์ผ ํ ์คํธ ๋ฐ ๋ฐฐ๊ฒฝ ๊ด๋ จ ์คํ์ผ (0) | 2024.04.16 |