హెచ్టిఎంఎల్ క్లాస్
- ముందు పేజీ HTML బ్లాక్
- తరువాత పేజీ HTML ఐడి
对 HTML 进行分类(设置类),使我们能够为元素的类定义 CSS 样式。
为相同的类设置相同的样式,或者为不同的类设置不同的样式。
ఉదాహరణ
<!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 is the capital city of England. ఇది యునైటెడ్ కింగ్డమ్ లో అత్యంత జనసంఖ్య కలిగిన నగరం, with a metropolitan area of over 13 million inhabitants. </p> </div> </body> </html>
分类块级元素
HTML <div> 元素是块级元素。它能够用作其他 HTML 元素的容器。
设置 <div> 元素的类,使我们能够为相同的 <div> 元素设置相同的类:
ఉదాహరణ
<!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 is the capital city of England. ఇది యునైటెడ్ కింగ్డమ్ లో అత్యంత జనసంఖ్య కలిగిన నగరం, మెట్రోపాలిటన్ ప్రాంతంలో 13 మిలియన్ జనాభా తో.</p> </div> <div class="cities"> <h2>పారిస్</h2> <p>పారిస్ ఫ్రాన్స్ రాజధాని మరియు అత్యంత జనసంఖ్య కలిగిన నగరం.</p> </div> <div class="cities"> <h2>టోక్యో</h2> <p>టోక్యో జపాన్ రాజధాని, గ్రేటర్ టోక్యో ప్రాంతం కేంద్రం,</p> మరియు ప్రపంచంలో అత్యంత జనసంఖ్య కలిగిన మెట్రోపాలిటన్ ప్రాంతం.</p> </div> </body> </html>
క్లాసిఫికేషన్ లైనర్ ఎలమెంట్స్
HTML స్పాన్ ఎలమెంట్ రూపం ఎలమెంట్, పదం కన్నా ఉపయోగించబడతాయి.
స్పాన్ ఎలమెంట్ క్లాస్ అనుసరించడం, అదే స్పాన్ ఎలమెంట్స్ కోసం ఒకే శైలీని అనుసరించడానికి సహాయపడుతుంది.
ఉదాహరణ
<!DOCTYPE html> <html> <head> <style> span.red {color:red;} </style> </head> <body> <h1>My <span class="red">Important</span> శీర్షిక</h1> </body> </html>
- ముందు పేజీ HTML బ్లాక్
- తరువాత పేజీ HTML ఐడి