HTML
Kod:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<link rel="stylesheet" href="css.css" />
</head>
<body>
<div id="main">
<p>
Centrerad text
</p>
<div class="box" style="background-color:blue;">
<img src="bild.gif" alt="" />
<p>
Vänsterställd text
</p>
</div>
<div class="box">
<img src="bild.gif" alt="" />
<p>
Vänsterställd text
</p>
</div>
</div>
</body>
</html>
CSS (döp filen till css.css)
Kod:
body, html{
height:100%;
margin:0;
}
#main{
margin:0 auto;
height:500px;
width:700px;
text-align:center;
background-color:gray;
}
.box img{
float:left;
}
.box p{
text-align:left;
}
.box{
clear:left;
width:500px;
margin:0 auto;
background-color:red;
overflow:hidden;
}
Vet inte om det här var det du var ute efter, hoppas det.