TIME NOW
World current time now,
CALENDAR
Calendar monthly, yearly
login GOLD PRICE, RATE
login HOROSCOPE
login DICTIONARIES, LISTS
login SCIENCE EDUCATION RELIGION
login FINANCE, BUSINESS
login WORLD COUNTRIES, WIKI

HTML code examples, samples, tutorial

Previous articlePage bottomNext article  ALL TOPICS

HTML. CSS lessons, examples - id, classes, inline style

 CSS Classes:
<html>
<head>
  <style>

  div { background-color: red;    color: black; }   
  #a  { background-color: green;  color: white; }
  #b  { background-color: blue;   color: white; }
  .a  { background-color: yellow; color: white; }
  .b  { background-color: pink;   color: white; }
  
  </style>
  
</head>
<body>

<div>DIV text</div>
<div>DIV text</div>
 
<div id = "a" >DIV text</div>
<div id = "b" >DIV text</div>

<div class = "a" >DIV text</div>
<div class = "a" >DIV text</div>
<div class = "a" >DIV text</div>

<div class = "b" >DIV text</div>
<div class = "b" >DIV text</div>
<div class = "b" >DIV text</div>
 
</body>
</html>

Inline style:
<html>
<head>
 
</head>
<body>

<div style = "color: red;   background-color: white;" >DIV text</div>
<div style = "color: blue;  background-color: red;"   >DIV text</div>
<div style = "color: black; background-color: blue;"  >DIV text</div>
<div style = "color: grey;  background-color: green;" >DIV text</div>
 
</body>
</html>

Priority:
<html><head>

<style>

    div   { color: red;   }
    .div  { color: green; }
    #div  { color: blue;  }
    #divA { color: blue;  }

</style> 

</head><body>

<div>1 DIV text</div>
<div class = "div" >2 DIV text</div>
<div class = "div" id = "div"  >3 DIV text</div>
<div class = "div" id = "divA" style = "color: grey;" >4 DIV text</div>
 
</body></html>
 
Classes for DIV and SPAN elements:
<html><head>

<style>

    .a  { color: red;   }
    .b  { color: green; }
    .c  { color: blue;  }
    
</style> 

</head><body>

O
N
A

<div  class = "a" >O</div>
<div  class = "b" >N</div>
<div  class = "c" >A</div>

<span class = "a" >O</span>
<span class = "b" >N</span>
<span class = "c" >A</span>

</body></html>
      


  
Previous articlePage topNext article  ALL TOPICS



 Use username: Guest, Anonymous, Programmer






QUOTES:
The strongest possible piece of advice I would give any young woman is Don't screw around, and don't smoke.
Edwina Currie
He is very comfortable, very happy about where he is now.
Eric Pooley
Woman is the dominant sex. Men have to do all sorts of stuff to prove that they are worthy of woman's attention.
Camille Paglia