pixel3cs
18.05.2009, 13:20
Html-ul simplu poate fi transformat si stilizat asa cum vrei daca te pricepi la CSS.
Un exemplu este meniul de mai joc care a fost transformat folsind CSS intr-un meniu interactiv cu animatie.
Cuvantul hover folosit ca sufix la o clasa CSS (.clasa:hover) spune browser-ului cum sa renderizeze un element atunci cand suntem cu mouse-ul peste el.
Copiati codul de mai jos in notepad si salvati ca page.html deschideti cu IE sau FF si vedeti ce a iesit.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
.container
{
width:200px;
}
.menu
{
display:block;
background-color:#999999;
height:25px;
line-height:25px;
font-family:Verdana;
font-size:11px;
text-decoration:none;
color:White;
margin-top:1px;
padding-left:10px;
}
.menu:hover
{
background-color:#777777;
padding-left:30px;
}
</style>
</head>
<body>
<div class="container">
<a class="menu" href="http://www.google.com">Google</a>
<a class="menu" href="http://www.yahoo.com">Yahoo</a>
<a class="menu" href="http://www.youtube.com">Youtube</a>
<a class="menu" href="http://www.microsoft.com">Microsoft</a>
</div>
</body>
</html>
Un exemplu este meniul de mai joc care a fost transformat folsind CSS intr-un meniu interactiv cu animatie.
Cuvantul hover folosit ca sufix la o clasa CSS (.clasa:hover) spune browser-ului cum sa renderizeze un element atunci cand suntem cu mouse-ul peste el.
Copiati codul de mai jos in notepad si salvati ca page.html deschideti cu IE sau FF si vedeti ce a iesit.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css">
.container
{
width:200px;
}
.menu
{
display:block;
background-color:#999999;
height:25px;
line-height:25px;
font-family:Verdana;
font-size:11px;
text-decoration:none;
color:White;
margin-top:1px;
padding-left:10px;
}
.menu:hover
{
background-color:#777777;
padding-left:30px;
}
</style>
</head>
<body>
<div class="container">
<a class="menu" href="http://www.google.com">Google</a>
<a class="menu" href="http://www.yahoo.com">Yahoo</a>
<a class="menu" href="http://www.youtube.com">Youtube</a>
<a class="menu" href="http://www.microsoft.com">Microsoft</a>
</div>
</body>
</html>