方法1:
<!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=UTF-8" />
<style type="text/css">
*{margin:0;padding:0;}
.left {float:left;width:200px;background-color:#ff0;height:500px;}
.right {background-color:#f00;height:500px;margin-left:200px;}
</style>
<title>My First Blog</title>
</head>
<body>
<div class="left">left</div>
<div class="right">right</div>
</body>
</html>
方法2:
<!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=UTF-8"
/>
<
style
type
=
"text/css"
>
*{margin:0;padding:0;}
body #lay{
width:800px;
background-color:#ccc;
}
.left {
float:left;
width:200px;
background-color:#ff0;
height:500px;
}
.right {
background-color:#f00;
height:500px;
}
</
style
>
<
title
>My First Blog</
title
>
</
head
>
<
body
>
<
div
id
=
"lay"
>
<
div
class
=
"left"
>left</
div
>
<
div
class
=
"right"
>right</
div
>
</
div
>
</
body
>
</
html
>