Search

속성 μ„ νƒμž

속성 μ„ νƒμž

νƒœκ·Έμ˜ 속성을 μ§€μ •ν•˜λŠ” μ„ νƒμž
[name=β€˜email’] { } [data=β€˜1’] { }
CSS
볡사
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>속성 μ„ νƒμž</title> <style> section { margin: 20px 0; } /* [속성] { } [속성='A'] { } : 속성='A' μš”μ†Œλ₯Ό 선택 [속성^='A'] { } : 속성='A'둜 μ‹œμž‘ν•˜λŠ” μš”μ†Œ 선택 [속성$='A'] { } : 속성='A'둜 λλ‚˜λŠ” μš”μ†Œ 선택 [속성*='A'] { } : 속성='A'λ₯Ό ν¬ν•¨ν•˜λŠ” μš”μ†Œ 선택 */ /* sectionνƒœκ·Έ, 속성 : id, 속성값 : '2' λλ‚˜λŠ” κ°’ */ section[id$='2'] { background-color: yellow; padding: 10px; } /* div νƒœκ·Έ, 속성λͺ… class */ div[class] { padding: 5px; margin: 5px; border: 1px solid #ccc; } /* 속성값이 'l'둜 μ‹œμž‘ν•˜λŠ” 경우 */ div[class^='l'] { background-color: skyblue; } /* 속성값에 'i'κ°€ ν¬ν•¨λ˜λŠ” 경우 */ div[class*='i'] { background-color: pink; } /* 속성값이 '4'둜 λλ‚˜λŠ” 경우 */ div[class$='4'] { background-color: royalblue; } /* 속성값이 'e'κ°€ ν¬ν•¨λ˜κ³  속성값이 '2'둜 λλ‚˜λŠ” 경우 */ div[class*='e'][class$='2'] { background-color: springgreen; } </style> </head> <body> <h1>속성 μ„ νƒμž</h1> <hr> <section id="part1"> <div class="lst1">μ†μ„±μ„ νƒμž 1</div> <div class="lis2">μ†μ„±μ„ νƒμž 2</div> <div class="le2">μ†μ„±μ„ νƒμž 3</div> <div class="l4">μ†μ„±μ„ νƒμž 4</div> </section> <hr> <section id="part2"> <div class="lst1">μ†μ„±μ„ νƒμž 1</div> <div class="lis2">μ†μ„±μ„ νƒμž 2</div> <div class="le2">μ†μ„±μ„ νƒμž 3</div> <div class="l4">μ†μ„±μ„ νƒμž 4</div> </section> </body> </html>
HTML
볡사