HTML class
Utilizarea Atributului HTML class
Atributul class HTML este folosit pentru a defini stiluri egale pentru elemente cu același nume de class.
Deci, toate elementele HTML cu același atribut de class vor obține același stil.
Sfat: atributul class poate fi folosit pe orice element HTML.
Notă: Numele class este sensibil la litere mari și mici!
Aici avem trei elemente <div> care indică același nume de class:
<element class = "denumirea class">.
Exemplu:
<!DOCTYPE html> <html> <head> <title>Cum se creează un buton HTML</title> <style> .orase {
background-color: navy;
color: yellow;
margin: 18px;
padding: 18px;
}
</style>
</head>
<body>
<h1>utilizare HTML class</h1>
<div class="orase">
<h2>Bucuresti</h2>
<p>Bucuresti este capitala Romaniei</p>
</div><div class="orase">
<h2>Sinaia</h2>
<p>Sinaia este o statiune turistica din Romania</p>
</div><div class="orase">
</body>
<h2>Constanta</h2>
<p>Constanta este un oras din Romania cu port</p>
</div>
</html>
Utilizarea atributului HTML class în elementele pe linie
Atributul HTML class poate fi folosit și pe elementele in line:
Exemplu 2:
<!DOCTYPE html> <html> <head> <title>HTML button onclick</title>
<style>
span.text
{
font-size: 120%;
color: red;
}
</style>
</head>
<body>
<h1>My <span class="text">HTML class</span> în elementele pe linie</h1>
<p>Aici adaugati <span class="text">textul dumneavoastra</span> cel mai bun.</p>
</body>
</html>
This tool makes it easy to create, adjust, and experiment with custom colors for the web.

Magnews2 is a modern and creative free magazine and news website template that will help you kick off your online project in style.

Find here examples of creative and unique website layouts.

Find here examples of creative and unique website CSS HTML menu.