兩個代碼有什么區別?為什么頁面顯示不同?
代碼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"?/>
<title>無標題文檔</title>
<style?type="text/css">
*{margin:0;?padding:0;}
#wrap{margin:0?auto;?width:960px;?background:#666;}
#header{background:#0F3;?width:100%;}
#mainbody{background:#33F;?width:100%;}
#footer{background:#999;?width:100%;}
.left{width:800px;height:200px;?background:#FF0;?float:left;}
.right{width:140px;?height:500px;?background:#F0F;?float:left;}
</style>
</head>
<body>
<div?id="wrap">
<div?id="header">header</div>
????<div?id="mainbody">
???? <div?class="left">left</div>
????????<div?class="right">right</div>
????</div>
????<div?id="footer">footer</div>
</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"?/>
<title>無標題文檔</title>
<style?type="text/css">
*?{
????margin:0;
padding:0;
}
#wrap?{
background:#00C;
margin:0?auto;
width:960px;
}
#header?{
background:#FF3300;
width:100%;
}
#mainbody?{
????background:#FC0;
???width:100%;
}
.left?{
width:800px;
height:200px;
background:#000;
????float:left;
}
.right?{
width:140px;
height:500px;
background:#690;
float:left;
}
#footer?{
background:#639;
width:100%;
}
</style>
</head>
<body>
<div?id="wrap">
??<div?id="header">頭部</div>
??<div?id="mainbody">
????<div?class="left"></div>
????<div?class="right"></div>
??</div>
??<div?id="footer">版權部分</div>
</div>
</body>
</body>
</html>
2016-12-21
<!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">
* {
? ? margin:0;
? ? padding:0;
}
#wrap {
? ? background:#00C;
? ? margin:0 auto;
? ? width:960px;
}
#header {
? ? background:#FF3300;
? ? width:100%;
}
#mainbody {
? ? ? ? background:#FC0;
? ? ? ?width:100%;
? ? ? ?overflow:hidden;
}
.left {
? ? width:800px;
? ? height:200px;
? ? background:#000;
? ? float:left;
}
.right {
width:140px;
height:500px;
background:#690;
float:right;
}
#footer {
? ? background:#639;
? ? width:100%;
}
</style>
</head>
?
<body>
<div id="wrap">
? <div id="header">頭部</div>
? <div id="mainbody">
? ? <div class="left"></div>
? ? <div class="right"></div>
? </div>
? <div id="footer">版權部分</div>
</div>
</body>
</html>
2016-11-07
而且神奇的是當中英文混合的時候,英文字母個數大于中文個數才行
2016-11-07
我發現是由于?<div?id="footer">版權部分</div>里面的內容是中文的原因,英文的話是不會出問題的
2016-11-04
看了半天?? 我只發現第二個代碼? 最后多了一個</body>
感覺是在玩一起來找茬。。。