查看完整版本: 關於div排版
頁: [1]

love10lorn 發表於 2015-7-10 04:24 PM

關於div排版

本帖最後由 love10lorn 於 2015-7-10 04:25 PM 編輯

自己測試很多次都無法成功,上網抓別人的測試也失敗,請問是我哪裡觀念錯??<!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">
<!--
#sidebar_left {
}
#header {
}
#sidebar_right {
}
#content {
}
#footer {
}
-->
</style></head>

<body>
<style type="text/css">
#sitebody{
 width:600px;
 margin:0 auto;
 font-size:13px;
}
#header{
 background-color:#FFD4D4;
 height:80px;
 text-align:center;
 line-height:80px;
}
#sidebar_left{
 background-color:#FFECC9;
 width:120px;
 height:400px;
 text-align:center;
 line-height:400px;
 float:left;
}
#sidebar_right{
 background-color:#FFECC9;
 width:120px;
 height:400px;
 text-align:center;
 line-height:400px;
 float:right;
}
#content{
 margin-left:120px;
 margin-right:120px;
 height:400px;
 background-color:#F2FFF2;
 text-align:center;
 line-height:400px;
}
#footer{
 clear:both;
 background-color:#FFD4D4;
 height:80px;
 text-align:center;
 line-height:80px;
}
</style>
<div id="sitebody">
 <div id="header">header</div>
 <div id="sidebar_left">sidebar_left</div>
 <div id="sidebar_right">sidebar_right</div>
 <div id="content">content</div>
 <div id="footer">footer</div>
</div>
</body>
</html>


...<div class='locked'><em>瀏覽完整內容,請先 <a href='member.php?mod=register'>註冊</a> 或 <a href='javascript:;' onclick="lsSubmit()">登入會員</a></em></div><div></div>

jansen5151 發表於 2015-7-11 11:37 AM

本帖最後由 jansen5151 於 2015-7-11 11:45 AM 編輯

<!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">
#sitebody{
 width:600px;
 margin:0 auto;
 font-size:13px;
}

#header{
 background-color:#FFD4D4;
 height:80px;
 text-align:center;
 line-height:80px;
}
#sidebar_left{
 background-color:#FFECC9;
 width:120px;
 height:400px;
 text-align:center;
 line-height:400px;
 float:left;
}
#sidebar_right{
 background-color:#FFECC9;
 width:120px;
 height:400px;
 text-align:center;
 line-height:400px;
 float:right;
}
#content{
 margin-left:120px;
 margin-right:120px;
 height:400px;
 background-color:#F2FFF2;
 text-align:center;
 line-height:400px;
}
#footer{
 clear:both;
 background-color:#FFD4D4;
 height:80px;
 text-align:center;
 line-height:80px;
}
</style>
</head>

<body>

<div id="sitebody">
 <div id='header'>header</div>
 <div id="sidebar_left">sidebar_left</div>
 <div id="sidebar_right">sidebar_right</div>
 <div id="content">content</div>
 <div id="footer">footer</div>
</div>
</body>
</html>
你複製去看看
1.id是唯一的,不能重複
2.你在head和body有相同內容
3.你的css應該是全形或半形...等有問題或用了中文的空白...(我也不知)
4.不信你將空白刪除就可以了
5.css規則:英文開頭,不能數字(開頭),要用 英/數 打字
6.命名規則:不能有中文,不能有符號,不能有空白,底線除外(可以用)
7.建議由html + css 語法開始學起..加油!

...<div class='locked'><em>瀏覽完整內容,請先 <a href='member.php?mod=register'>註冊</a> 或 <a href='javascript:;' onclick="lsSubmit()">登入會員</a></em></div>
頁: [1]