+ -
当前位置:首页 → 问答吧 → 新手求助

新手求助

时间:2011-11-05

来源:互联网

刚开始接触css就一头雾水,如何让 #ex1,#ex2,#ex3 3个块能在一列并列显示,变成相互衔接的3个块
代码如下:

<!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" />
<title>无标题文档</title>
<style type="text/css">
#body {
padding:0;
margin:0;
border:0;
text-align:center;
}
#ex0,#ex1,#ex2,#ex3,#ex4,#ex5 {
border:solid;
}
#ex1 {
background-color:red;
width:100px;


}

#ex2 {
background-color:blue;
width:100px;

position:relative;


}
#ex3 {
background-color:green;
width:100px;
}

#ex4 {
background-color:#F3F;
width:1000px;
}
#ex0 {
background-color:#399;
width:1000px;
}
</style>
</head>

<body>
<div id="ex0">此处显示 id "ex0" 的内容</div>
<div id="main">
<div id="ex1">此处显示 id "ex1" 的内容</div>
<div id="ex2">此处显示 id "ex2" 的内容</div>
<div id="ex3">此处显示 id "ex3" 的内容</div>
</div>
<div id="ex4">此处显示 id "ex4" 的内容</div>
<div id="ex5">此处显示 id "ex5" 的内容</div>
</body>
</html>

作者: fanfanlove2025   发布时间: 2011-11-05

HTML code
<!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" />
<title>无标题文档</title>
<style type="text/css">
#body {
padding:0;
margin:0;
border:0;
text-align:center;
}
#ex0,#ex1,#ex2,#ex3,#ex4,#ex5 {
border:solid;
}
#main{ float:left;}
#ex1 {
    float:left;
background-color:red;
width:100px;

}

#ex2 {
    float:left;
background-color:blue;
width:100px;



}
#ex3 {
    float:left;
background-color:green;
width:100px;
}

#ex4 {
    clear:left;
background-color:#F3F;
width:1000px;
}
#ex0 {
background-color:#399;
width:1000px;
}
</style>
</head>

<body>
<div id="ex0">此处显示 id "ex0" 的内容</div>
<div id="main">
<div id="ex1">此处显示 id "ex1" 的内容</div>
<div id="ex2">此处显示 id "ex2" 的内容</div>
<div id="ex3">此处显示 id "ex3" 的内容</div>
</div>
<div id="ex4">此处显示 id "ex4" 的内容</div>
<div id="ex5">此处显示 id "ex5" 的内容</div>
</body>
</html>




这样 OK了把!·

作者: ssdltwp   发布时间: 2011-11-05