<!doctype html>
<html>
<head>
<title>CSS Selector</title>
<meta charset="utf-8">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Black+Han+Sans&family=Nanum+Pen+Script&display=swap" rel="stylesheet">
<style>
body {
font-family: 'Nanum Pen Script', cursive;
}
h1 {
font-family: 'Black Han Sans', sans-serif;
}
/* μ°κ²°(볡ν©)μ νμ */
img+p {
font-style: italic;
}
/* imgμ 첫째λμ p μ ν */
p~span {
color: red;
}
/*pμ λμμΈ spanλ€μ λͺ¨λ μ ν*/
/* μμ± μ νμ */
a[href] {
color: red;
}
/* κ°μ΄ μΌμΉνλ μμ μ ν */
a[href="http://example.com"] {
color: orange;
}
/* κ³Ό μμ±κ°μ΄ μΌμΉνλ μμ μ ν */
a[href ^="#"] {
color: green;
}
/* κ°μΌλ‘ μμνλ μμ μ ν */
a[href $=".org"] {
color: orchid;
}
/* κ°μΌλ‘ λλλ μμ μ ν */
a[href *="example"] {
color: blueviolet;
}
/* κ°μ΄ λ€μ΄μλ μμ μ ν */
a[href~="example"] {
color: darkcyan;
}
/* κ°μ μ λ€μ κ³΅λ°±μ΄ μλ ννμ μμ μ ν */
/* μ
λ ₯μμ λ§λ€ λ μμ£Ό μ */
input[type="text"] {
/* input μμ μ€μ text νμ
μΈ κ² */
background-color: skyblue;
}
/* κ°μ ν΄λμ€ μ νμ */
a:hover {
background-color: orange;
}
a:link {
color: red;
}
a:visited {
color: darkgoldenrod;
}
a:active {
color: darkgreen;
}
input:focus {
/* μ
λ ₯λ°μ€μ€μ νμ¬ λ§μ°μ€λ‘ μ νλ κ² μ§μ */
background-color: beige;
border: 3px solid blue;
}
p:first-of-type {
/* */
border-bottom: 2px dotted red;
}
li:first-child {
background-color: aqua;
}
li:last-child {
background-color: violet;
}
li:nth-child(2) {
/* λ λ²μ§Έ κ² μ ν. 2 μ리μ μ«μλ₯Ό λ£μ΄μ μνλ κ² μ ν κ°λ₯. 2 λ€μ nμ λΆμ΄λ©΄ μ§μλ²μ§Έ μ ν 2n+1μ νμλ²μ§Έ
or
even μ§μ
odd νμλ κ°λ₯*/
background-color: olivedrab;
}
/* κ°μ μμ μ νμ */
h1::first-letter {
font-size: 1.5em;
}
p::first-line {
background-color: bisque;
}
p>a::after {
content: "!!!!";
border: 1px dotted red;
}
span[data-descr] {
position: relative;
text-decoration: underline;
color: #00f;
cursor: pointer;
}
span[data-descr]:focus::after {
content: attr(data-descr);
/* attr()ν¨μλ μμ±κ°μ μ½μ΄μ΄ */
position: absolute;
left: 0;
top: 24px;
min-width: 200px;
border: 1px solid #aaa;
border-radius: 10px;
background-color: #ffffcc;
padding: 12px;
font-size: 14px;
z-index: 1;
}
table,
th,
td {
border: 1px solid black;
border-collapse: collapse;
}
table {
width: 50%;
margin: 0 auto;
height: 300px;
}
td {
text-align: center;
vertical-align: center;
}
tr:nth-child(even) {
background-color: skyblue;
}
</style>
</head>
<body>
<h1>CSS combinators(μ‘°ν©μ νμ)</h1>
<div>
<img src="">
<p>Empty Image<br>Image2</p>
<span>This is not red.</span>
<p>Here is a paragraph.</p>
<code>Here is some code.</code>
<pre></pre>
<span>And here is a red span!</span>
<code>More code...</code>
<span>And this is a red span!</span>
</div>
<h1>CSS attribute selector(μμ±μ νμ)</h1>
<ul>
<li><a href="#internal">Internal link</a></li>
<li><a href="http://example.com">Example link</a></li>
<li><a href="#InSensitive">Insensitive internal link</a></li>
<li><a href="http://example.org example">Example org link</a></li>
</ul>
<div lang="en-us en-gb en-au en-nz">Hello World!</div>
<div lang="pt">Olá Mundo!</div>
<div lang="zh-CN">δΈηζ¨ε₯½οΌ</div>
<div lang="zh-TW">δΈηζ¨ε₯½οΌ</div>
<div data-lang="zh-TW">?δΈηζ¨ε₯½οΌ</div>
<ul>
<li class="number">One</li>
<li class="number">Two!</li>
<li class="number">Three</li>
<li class="number">Four</li>
</ul>
<h1>CSS pseudo-classes(κ°μν΄λμ€)</h1>
<p>κ°μ ν΄λμ€λ μμμ νΉμ μνμ λ°λΌ μ€νμΌμ μ μν λ μ¬μ©λλ€. νΉμ μνλ μλ₯Ό λ€μ΄ λ€μκ³Ό κ°λ€.</p>
<p>Mouse over and click the link: <a href="https://www.google.com">Google.com</a></p>
<p>μ΄ μμ λ
<span tabindex="0" data-descr="λ¨μ΄μ λ¬Έμ₯ λΆνΈμ μ§ν©">ν
μ€νΈ</span>μ ν¨κ» μ½κ°μ
<span tabindex="0" data-descr="νΈλ² μ 보μ¬μ§λ μμ νμ
">ν΄ν</span>μ ν¬ν¨ν©λλ€.
</p>
<input type="text" placeholder="Your name...">
<hr>
<table>
<tr>
<th>First Name</th>
<th>Last Name</th>
<th>Points</th>
</tr>
<tr>
<td>Peter</td>
<td>Griffin</td>
<td>$100</td>
</tr>
<tr>
<td>Lois</td>
<td>Griffin</td>
<td>$150</td>
</tr>
<tr>
<td>Joe</td>
<td>Swanson</td>
<td>$300</td>
</tr>
<tr>
<td>Cleveland</td>
<td>Brown</td>
<td>$250</td>
</tr>
<tr>
<td>Jessy</td>
<td>White</td>
<td>$270</td>
</tr>
<tr>
<td>Harry</td>
<td>Hunt</td>
<td>$330</td>
</tr>
</table>
</body>
</html>
LIST
'π Coding Study > μΉ λμμΈ' μΉ΄ν κ³ λ¦¬μ λ€λ₯Έ κΈ
2023.04.05 μ (HTML λ°μ€λͺ¨λΈ, λ°μ€μ¬μ΄μ§, *μ νμ λ±) (0) | 2023.04.05 |
---|---|
2023.04.03 μ (HTML position) (0) | 2023.04.03 |
2023.03.29 μ (CSS μ€μ΅) (0) | 2023.03.29 |
2023.03.27 μ (CSS) (0) | 2023.03.27 |
2023.03.22 μ (HTML λ©ν°λ―Έλμ΄ μλ£ νκ·Έ) (0) | 2023.03.22 |