This is my code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "<html xmlns="<head>
<title>CSS testing 1</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
.vert {
background-color: green;
width: 500px;
height: 500px;
}
.jaune {
width: 100px;
height: 50px;
background-color: yellow;
position: relative;
float: right;
}
div {
text-align: center;
color: #FFFFFF;
font-family: Verdana;
font-size: 9px;
font-weight: bold;
}
.bleu {
width: 100px;
height: 50px;
background-color: blue;
position: relative;
float: left;
}
.rouge {
float: left;
width: 100px;
height: 50px;
background-color: red;
position: relative;
clear: right;
top: 400px;
}
.noir {
float: right;
width: 100px;
height: 50px;
background-color: black;
position: relative;
clear: right;
top: 400px;
}
</style>
</head>
<body>
<div class="vert">
<div class="jaune">jaune</div>
<div class="bleu">bleu</div>
<div class="rouge">rouge</div>
<div class="noir">noir</div>
</div>
</body>
</html>
This displays 100% how I want it to do. It is W3C validated. I just want to know if I used the correct code to do what I did. I really want to learn CSS the best possible way.
Any ideas on how I can optimize my code or is it already (?) optimized?
Thanks :]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "<html xmlns="<head>
<title>CSS testing 1</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<style type="text/css">
.vert {
background-color: green;
width: 500px;
height: 500px;
}
.jaune {
width: 100px;
height: 50px;
background-color: yellow;
position: relative;
float: right;
}
div {
text-align: center;
color: #FFFFFF;
font-family: Verdana;
font-size: 9px;
font-weight: bold;
}
.bleu {
width: 100px;
height: 50px;
background-color: blue;
position: relative;
float: left;
}
.rouge {
float: left;
width: 100px;
height: 50px;
background-color: red;
position: relative;
clear: right;
top: 400px;
}
.noir {
float: right;
width: 100px;
height: 50px;
background-color: black;
position: relative;
clear: right;
top: 400px;
}
</style>
</head>
<body>
<div class="vert">
<div class="jaune">jaune</div>
<div class="bleu">bleu</div>
<div class="rouge">rouge</div>
<div class="noir">noir</div>
</div>
</body>
</html>
This displays 100% how I want it to do. It is W3C validated. I just want to know if I used the correct code to do what I did. I really want to learn CSS the best possible way.
Any ideas on how I can optimize my code or is it already (?) optimized?
Thanks :]