html css 布局
终极管理员 知识笔记 68阅读
对于初学者来说,使用css进行网页布局并不容易。css的布局方式总让我觉得不是什么好的布局方式,但是又这么受欢迎(呵呵,可能是新手这么想)。有时候看到一个网站做的不错,就想看看它是怎么布局的。结果一看网页的源代码,代码太多太乱,基本上复杂得看不懂。这无疑是基础没有打好的原因。今天又重温了w3cshool上css部队的内容,把其中一个简单常见的布局取了下来,以备不时之需。html head style type=' text/CSS ' div。容器{宽度:100%;保证金:0 px;border:1pxsolidgray
, 1); color: rgba(255, 0, 0, 1)">line-height:150%;
}
div.header,div.footer
{
padding:0.5em;
color:white;
background-color:gray;
clear:left;
}
h1.header
{
padding:0;
margin:0;
}
div.left
{
float:left;
width:160px;
margin:0;
padding:1em;
}
div.content
{
margin-left:190px;
border-left:1px solid gray;
padding:1em;
}
</style>
</head>
<body>
<div class="container">
<div class="header"><h1 class="header">W3School.com.cn</h1></div>
<div class="left"><p>"Never increase, beyond what is necessary, the number of entities required to explain anything." William of Ockham (1285-1349)</p></div>
<div class="content">
<h2>Free Web Building Tutorials</h2>
<p>At W3School.com.cn you will find all the Web-building tutorials you need,
from basic HTML and XHTML to advanced XML, XSL, Multimedia and WAP.</p>
<p>W3School.com.cn - The Largest Web Developers Site On The Net!</p></div>
<div class="footer">Copyright 2008 by YingKe Investment.</div>
</div>
</body>
</html>