HTML Classes
Iklasipika ang HTML (maglagay ng klase) upang mabigyan ng CSS style ang klase ng elemento.
Maglagay ng parehong estilo para sa parehong klase o iba't ibang estilo para sa iba't ibang klase.
实例
<!DOCTYPE html> <html> <head> <style> .cities { background-color:black; color:white; margin:20px; padding:20px; } </style> </head> <body> <div class="cities"> <h2>London</h2> <p> London ay kapital na siyudad ng Inglatera. It is the most populous city in the United Kingdom, may isang metropolitan area na may higit sa 13 million na naninirahan. </p> </div> </body> </html>
Block Level Element Category
Ang HTML <div> ayBlock Level ElementMaaaring magamit bilang konteiner ng ibang HTML na elemento.
Iset ang klase ng <div> na nagiging dahilan para sa parehong <div> upang maglagay ng parehong klase:
实例
<!DOCTYPE html> <html> <head> <style> .cities { background-color:black; color:white; margin:20px; padding:20px; } </style> </head> <body> <div class="cities"> <h2>London</h2> <p>London ay kapital na siyudad ng Inglatera. It is the most populous city in the United Kingdom, with a metropolitan area of over 13 million inhabitants.</p> </div> <div class="cities"> <h2>Paris</h2> <p>Paris is the capital and most populous city of France.</p> </div> <div class="cities"> <h2>Tokyo</h2> <p>Tokyo is the capital of Japan, the center of the Greater Tokyo Area,</p> at the most populous metropolitan area in the world.</p> </div> </body> </html>
分类行内元素
HTML <span> 元素是行内元素,能够用作文本的容器。
设置 <span> 元素的类,能够为相同的 <span> 元素设置相同的样式。
实例
<!DOCTYPE html> <html> <head> <style> span.red {color:red;} </style> </head> <body> <h1>My <span class="red">Important</span> Heading</h1> </body> </html>