Html 以三列布局居中页面
我的页面布局有问题。我试着做一个页眉,三栏,页脚的布局,全部居中。这是我的密码:Html 以三列布局居中页面,html,css,Html,Css,我的页面布局有问题。我试着做一个页眉,三栏,页脚的布局,全部居中。这是我的密码: #pgCenter { text-align:center; margin: 20px; } #container { text-align:left; width: 960px; margin: 0 auto; } #header { width:10
#pgCenter
{
text-align:center;
margin: 20px;
}
#container
{
text-align:left;
width: 960px;
margin: 0 auto;
}
#header
{
width:100%;
text-align:center;
}
#footer
{
text-align:center;
width: 100%;
}
.oneThirdContainer {
width: 300px;
float: left;
}
.clear {
clear: both;
}
</style>
<div id="pgCenter">
<form id="form1" runat="server">
<div id="container">
<div id="header">
here is my header
</div>
<div class="oneThirdContainer">
<p>This is where the login control goes. For testing purposes, I'll just throw some text in here.</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2mid - And here is some more placehold text so that I can see how this div is laying out!
I should also write some more text here because I still don't see anything going on :(</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2side - What else do you want me to put? I can't even think of anything right now except
eating some bomb delicious wingstop. I can't wait to get my paws on those saucy spicy cajun flavored mudda fuggas!</p>
</div>
<div class="clear"></div>
<div id="footer">
<p>(footer) Copyright © 2011</p>
</div>
</div>
</form>
</div>
</body>
css:
#pgCenter
{
text-align:center;
margin: 20px;
}
#container
{
text-align:left;
width: 960px;
margin: 0 auto;
}
#header
{
width:100%;
text-align:center;
}
#footer
{
text-align:center;
width: 100%;
}
.oneThirdContainer {
width: 300px;
float: left;
}
.clear {
clear: both;
}
</style>
<div id="pgCenter">
<form id="form1" runat="server">
<div id="container">
<div id="header">
here is my header
</div>
<div class="oneThirdContainer">
<p>This is where the login control goes. For testing purposes, I'll just throw some text in here.</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2mid - And here is some more placehold text so that I can see how this div is laying out!
I should also write some more text here because I still don't see anything going on :(</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2side - What else do you want me to put? I can't even think of anything right now except
eating some bomb delicious wingstop. I can't wait to get my paws on those saucy spicy cajun flavored mudda fuggas!</p>
</div>
<div class="clear"></div>
<div id="footer">
<p>(footer) Copyright © 2011</p>
</div>
</div>
</form>
</div>
</body>
html:
#pgCenter
{
text-align:center;
margin: 20px;
}
#container
{
text-align:left;
width: 960px;
margin: 0 auto;
}
#header
{
width:100%;
text-align:center;
}
#footer
{
text-align:center;
width: 100%;
}
.oneThirdContainer {
width: 300px;
float: left;
}
.clear {
clear: both;
}
</style>
<div id="pgCenter">
<form id="form1" runat="server">
<div id="container">
<div id="header">
here is my header
</div>
<div class="oneThirdContainer">
<p>This is where the login control goes. For testing purposes, I'll just throw some text in here.</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2mid - And here is some more placehold text so that I can see how this div is laying out!
I should also write some more text here because I still don't see anything going on :(</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2side - What else do you want me to put? I can't even think of anything right now except
eating some bomb delicious wingstop. I can't wait to get my paws on those saucy spicy cajun flavored mudda fuggas!</p>
</div>
<div class="clear"></div>
<div id="footer">
<p>(footer) Copyright © 2011</p>
</div>
</div>
</form>
</div>
</body>
这是我的头
这就是登录控件的位置。出于测试目的,我将在这里输入一些文本。
内部DIV ID:col2mid-这里还有一些placehold文本,以便我可以看到这个DIV是如何布局的!
我还应该在这里多写一些文字,因为我仍然没有看到任何进展:(
#pgCenter
{
text-align:center;
margin: 20px;
}
#container
{
text-align:left;
width: 960px;
margin: 0 auto;
}
#header
{
width:100%;
text-align:center;
}
#footer
{
text-align:center;
width: 100%;
}
.oneThirdContainer {
width: 300px;
float: left;
}
.clear {
clear: both;
}
</style>
<div id="pgCenter">
<form id="form1" runat="server">
<div id="container">
<div id="header">
here is my header
</div>
<div class="oneThirdContainer">
<p>This is where the login control goes. For testing purposes, I'll just throw some text in here.</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2mid - And here is some more placehold text so that I can see how this div is laying out!
I should also write some more text here because I still don't see anything going on :(</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2side - What else do you want me to put? I can't even think of anything right now except
eating some bomb delicious wingstop. I can't wait to get my paws on those saucy spicy cajun flavored mudda fuggas!</p>
</div>
<div class="clear"></div>
<div id="footer">
<p>(footer) Copyright © 2011</p>
</div>
</div>
</form>
</div>
</body>
INSIDE DIV ID:col2side-你还想让我放什么?我现在甚至想不出什么,除了
吃了些美味的鸡翅。我迫不及待地想把我的爪子放在那些辣辣的卡琼口味的穆达浓烟上
#pgCenter
{
text-align:center;
margin: 20px;
}
#container
{
text-align:left;
width: 960px;
margin: 0 auto;
}
#header
{
width:100%;
text-align:center;
}
#footer
{
text-align:center;
width: 100%;
}
.oneThirdContainer {
width: 300px;
float: left;
}
.clear {
clear: both;
}
</style>
<div id="pgCenter">
<form id="form1" runat="server">
<div id="container">
<div id="header">
here is my header
</div>
<div class="oneThirdContainer">
<p>This is where the login control goes. For testing purposes, I'll just throw some text in here.</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2mid - And here is some more placehold text so that I can see how this div is laying out!
I should also write some more text here because I still don't see anything going on :(</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2side - What else do you want me to put? I can't even think of anything right now except
eating some bomb delicious wingstop. I can't wait to get my paws on those saucy spicy cajun flavored mudda fuggas!</p>
</div>
<div class="clear"></div>
<div id="footer">
<p>(footer) Copyright © 2011</p>
</div>
</div>
</form>
</div>
</body>
(页脚)版权所有©2011
#pgCenter
{
text-align:center;
margin: 20px;
}
#container
{
text-align:left;
width: 960px;
margin: 0 auto;
}
#header
{
width:100%;
text-align:center;
}
#footer
{
text-align:center;
width: 100%;
}
.oneThirdContainer {
width: 300px;
float: left;
}
.clear {
clear: both;
}
</style>
<div id="pgCenter">
<form id="form1" runat="server">
<div id="container">
<div id="header">
here is my header
</div>
<div class="oneThirdContainer">
<p>This is where the login control goes. For testing purposes, I'll just throw some text in here.</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2mid - And here is some more placehold text so that I can see how this div is laying out!
I should also write some more text here because I still don't see anything going on :(</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2side - What else do you want me to put? I can't even think of anything right now except
eating some bomb delicious wingstop. I can't wait to get my paws on those saucy spicy cajun flavored mudda fuggas!</p>
</div>
<div class="clear"></div>
<div id="footer">
<p>(footer) Copyright © 2011</p>
</div>
</div>
</form>
</div>
</body>
我遇到的问题是,页眉和页脚内容希望根据其内容的大小显示在第一列或外部(col2outer
)列的上方和下方,而不是以整齐堆叠的方式显示所有列。此col2outer div
也显示为比第一列低1
#pgCenter
{
text-align:center;
margin: 20px;
}
#container
{
text-align:left;
width: 960px;
margin: 0 auto;
}
#header
{
width:100%;
text-align:center;
}
#footer
{
text-align:center;
width: 100%;
}
.oneThirdContainer {
width: 300px;
float: left;
}
.clear {
clear: both;
}
</style>
<div id="pgCenter">
<form id="form1" runat="server">
<div id="container">
<div id="header">
here is my header
</div>
<div class="oneThirdContainer">
<p>This is where the login control goes. For testing purposes, I'll just throw some text in here.</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2mid - And here is some more placehold text so that I can see how this div is laying out!
I should also write some more text here because I still don't see anything going on :(</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2side - What else do you want me to put? I can't even think of anything right now except
eating some bomb delicious wingstop. I can't wait to get my paws on those saucy spicy cajun flavored mudda fuggas!</p>
</div>
<div class="clear"></div>
<div id="footer">
<p>(footer) Copyright © 2011</p>
</div>
</div>
</form>
</div>
</body>
我看了这里和其他地方的一些帖子,找不到合适的帮助。我不太擅长css,希望能得到关于最佳实践、我做错了什么等的任何建议和提示。非常感谢
#pgCenter
{
text-align:center;
margin: 20px;
}
#container
{
text-align:left;
width: 960px;
margin: 0 auto;
}
#header
{
width:100%;
text-align:center;
}
#footer
{
text-align:center;
width: 100%;
}
.oneThirdContainer {
width: 300px;
float: left;
}
.clear {
clear: both;
}
</style>
<div id="pgCenter">
<form id="form1" runat="server">
<div id="container">
<div id="header">
here is my header
</div>
<div class="oneThirdContainer">
<p>This is where the login control goes. For testing purposes, I'll just throw some text in here.</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2mid - And here is some more placehold text so that I can see how this div is laying out!
I should also write some more text here because I still don't see anything going on :(</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2side - What else do you want me to put? I can't even think of anything right now except
eating some bomb delicious wingstop. I can't wait to get my paws on those saucy spicy cajun flavored mudda fuggas!</p>
</div>
<div class="clear"></div>
<div id="footer">
<p>(footer) Copyright © 2011</p>
</div>
</div>
</form>
</div>
</body>
PS-请原谅我的位置持有文本hehe。使用溢出:隐藏:
#pgCenter
{
text-align:center;
margin: 20px;
}
#container
{
text-align:left;
width: 960px;
margin: 0 auto;
}
#header
{
width:100%;
text-align:center;
}
#footer
{
text-align:center;
width: 100%;
}
.oneThirdContainer {
width: 300px;
float: left;
}
.clear {
clear: both;
}
</style>
<div id="pgCenter">
<form id="form1" runat="server">
<div id="container">
<div id="header">
here is my header
</div>
<div class="oneThirdContainer">
<p>This is where the login control goes. For testing purposes, I'll just throw some text in here.</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2mid - And here is some more placehold text so that I can see how this div is laying out!
I should also write some more text here because I still don't see anything going on :(</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2side - What else do you want me to put? I can't even think of anything right now except
eating some bomb delicious wingstop. I can't wait to get my paws on those saucy spicy cajun flavored mudda fuggas!</p>
</div>
<div class="clear"></div>
<div id="footer">
<p>(footer) Copyright © 2011</p>
</div>
</div>
</form>
</div>
</body>
#pgCenter
{
text-align:center;
margin: 20px;
}
#container
{
text-align:left;
width: 960px;
margin: 0 auto;
}
#header
{
width:100%;
text-align:center;
}
#footer
{
text-align:center;
width: 100%;
}
.oneThirdContainer {
width: 300px;
float: left;
}
.clear {
clear: both;
}
</style>
<div id="pgCenter">
<form id="form1" runat="server">
<div id="container">
<div id="header">
here is my header
</div>
<div class="oneThirdContainer">
<p>This is where the login control goes. For testing purposes, I'll just throw some text in here.</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2mid - And here is some more placehold text so that I can see how this div is laying out!
I should also write some more text here because I still don't see anything going on :(</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2side - What else do you want me to put? I can't even think of anything right now except
eating some bomb delicious wingstop. I can't wait to get my paws on those saucy spicy cajun flavored mudda fuggas!</p>
</div>
<div class="clear"></div>
<div id="footer">
<p>(footer) Copyright © 2011</p>
</div>
</div>
</form>
</div>
</body>
使用溢出:隐藏:
#pgCenter
{
text-align:center;
margin: 20px;
}
#container
{
text-align:left;
width: 960px;
margin: 0 auto;
}
#header
{
width:100%;
text-align:center;
}
#footer
{
text-align:center;
width: 100%;
}
.oneThirdContainer {
width: 300px;
float: left;
}
.clear {
clear: both;
}
</style>
<div id="pgCenter">
<form id="form1" runat="server">
<div id="container">
<div id="header">
here is my header
</div>
<div class="oneThirdContainer">
<p>This is where the login control goes. For testing purposes, I'll just throw some text in here.</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2mid - And here is some more placehold text so that I can see how this div is laying out!
I should also write some more text here because I still don't see anything going on :(</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2side - What else do you want me to put? I can't even think of anything right now except
eating some bomb delicious wingstop. I can't wait to get my paws on those saucy spicy cajun flavored mudda fuggas!</p>
</div>
<div class="clear"></div>
<div id="footer">
<p>(footer) Copyright © 2011</p>
</div>
</div>
</form>
</div>
</body>
#pgCenter
{
text-align:center;
margin: 20px;
}
#container
{
text-align:left;
width: 960px;
margin: 0 auto;
}
#header
{
width:100%;
text-align:center;
}
#footer
{
text-align:center;
width: 100%;
}
.oneThirdContainer {
width: 300px;
float: left;
}
.clear {
clear: both;
}
</style>
<div id="pgCenter">
<form id="form1" runat="server">
<div id="container">
<div id="header">
here is my header
</div>
<div class="oneThirdContainer">
<p>This is where the login control goes. For testing purposes, I'll just throw some text in here.</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2mid - And here is some more placehold text so that I can see how this div is laying out!
I should also write some more text here because I still don't see anything going on :(</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2side - What else do you want me to put? I can't even think of anything right now except
eating some bomb delicious wingstop. I can't wait to get my paws on those saucy spicy cajun flavored mudda fuggas!</p>
</div>
<div class="clear"></div>
<div id="footer">
<p>(footer) Copyright © 2011</p>
</div>
</div>
</form>
</div>
</body>
要解决第一个问题,只需将
清除:两个添加到#container#footer
,即可清除其上方的浮动
#pgCenter
{
text-align:center;
margin: 20px;
}
#container
{
text-align:left;
width: 960px;
margin: 0 auto;
}
#header
{
width:100%;
text-align:center;
}
#footer
{
text-align:center;
width: 100%;
}
.oneThirdContainer {
width: 300px;
float: left;
}
.clear {
clear: both;
}
</style>
<div id="pgCenter">
<form id="form1" runat="server">
<div id="container">
<div id="header">
here is my header
</div>
<div class="oneThirdContainer">
<p>This is where the login control goes. For testing purposes, I'll just throw some text in here.</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2mid - And here is some more placehold text so that I can see how this div is laying out!
I should also write some more text here because I still don't see anything going on :(</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2side - What else do you want me to put? I can't even think of anything right now except
eating some bomb delicious wingstop. I can't wait to get my paws on those saucy spicy cajun flavored mudda fuggas!</p>
</div>
<div class="clear"></div>
<div id="footer">
<p>(footer) Copyright © 2011</p>
</div>
</div>
</form>
</div>
</body>
#container#col2outer
问题是因为内部的p
元素默认设置了一些margin
#pgCenter
{
text-align:center;
margin: 20px;
}
#container
{
text-align:left;
width: 960px;
margin: 0 auto;
}
#header
{
width:100%;
text-align:center;
}
#footer
{
text-align:center;
width: 100%;
}
.oneThirdContainer {
width: 300px;
float: left;
}
.clear {
clear: both;
}
</style>
<div id="pgCenter">
<form id="form1" runat="server">
<div id="container">
<div id="header">
here is my header
</div>
<div class="oneThirdContainer">
<p>This is where the login control goes. For testing purposes, I'll just throw some text in here.</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2mid - And here is some more placehold text so that I can see how this div is laying out!
I should also write some more text here because I still don't see anything going on :(</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2side - What else do you want me to put? I can't even think of anything right now except
eating some bomb delicious wingstop. I can't wait to get my paws on those saucy spicy cajun flavored mudda fuggas!</p>
</div>
<div class="clear"></div>
<div id="footer">
<p>(footer) Copyright © 2011</p>
</div>
</div>
</form>
</div>
</body>
此外,您应该从所有选择器的开始处删除无关的#容器
#pgCenter
{
text-align:center;
margin: 20px;
}
#container
{
text-align:left;
width: 960px;
margin: 0 auto;
}
#header
{
width:100%;
text-align:center;
}
#footer
{
text-align:center;
width: 100%;
}
.oneThirdContainer {
width: 300px;
float: left;
}
.clear {
clear: both;
}
</style>
<div id="pgCenter">
<form id="form1" runat="server">
<div id="container">
<div id="header">
here is my header
</div>
<div class="oneThirdContainer">
<p>This is where the login control goes. For testing purposes, I'll just throw some text in here.</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2mid - And here is some more placehold text so that I can see how this div is laying out!
I should also write some more text here because I still don't see anything going on :(</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2side - What else do you want me to put? I can't even think of anything right now except
eating some bomb delicious wingstop. I can't wait to get my paws on those saucy spicy cajun flavored mudda fuggas!</p>
</div>
<div class="clear"></div>
<div id="footer">
<p>(footer) Copyright © 2011</p>
</div>
</div>
</form>
</div>
</body>
所有这些更改:要解决第一个问题,只需将清除:两个
添加到#container#footer
,以清除其上方的浮动
#pgCenter
{
text-align:center;
margin: 20px;
}
#container
{
text-align:left;
width: 960px;
margin: 0 auto;
}
#header
{
width:100%;
text-align:center;
}
#footer
{
text-align:center;
width: 100%;
}
.oneThirdContainer {
width: 300px;
float: left;
}
.clear {
clear: both;
}
</style>
<div id="pgCenter">
<form id="form1" runat="server">
<div id="container">
<div id="header">
here is my header
</div>
<div class="oneThirdContainer">
<p>This is where the login control goes. For testing purposes, I'll just throw some text in here.</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2mid - And here is some more placehold text so that I can see how this div is laying out!
I should also write some more text here because I still don't see anything going on :(</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2side - What else do you want me to put? I can't even think of anything right now except
eating some bomb delicious wingstop. I can't wait to get my paws on those saucy spicy cajun flavored mudda fuggas!</p>
</div>
<div class="clear"></div>
<div id="footer">
<p>(footer) Copyright © 2011</p>
</div>
</div>
</form>
</div>
</body>
#container#col2outer
问题是因为内部的p
元素默认设置了一些margin
#pgCenter
{
text-align:center;
margin: 20px;
}
#container
{
text-align:left;
width: 960px;
margin: 0 auto;
}
#header
{
width:100%;
text-align:center;
}
#footer
{
text-align:center;
width: 100%;
}
.oneThirdContainer {
width: 300px;
float: left;
}
.clear {
clear: both;
}
</style>
<div id="pgCenter">
<form id="form1" runat="server">
<div id="container">
<div id="header">
here is my header
</div>
<div class="oneThirdContainer">
<p>This is where the login control goes. For testing purposes, I'll just throw some text in here.</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2mid - And here is some more placehold text so that I can see how this div is laying out!
I should also write some more text here because I still don't see anything going on :(</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2side - What else do you want me to put? I can't even think of anything right now except
eating some bomb delicious wingstop. I can't wait to get my paws on those saucy spicy cajun flavored mudda fuggas!</p>
</div>
<div class="clear"></div>
<div id="footer">
<p>(footer) Copyright © 2011</p>
</div>
</div>
</form>
</div>
</body>
此外,您应该从所有选择器的开始处删除无关的#容器
#pgCenter
{
text-align:center;
margin: 20px;
}
#container
{
text-align:left;
width: 960px;
margin: 0 auto;
}
#header
{
width:100%;
text-align:center;
}
#footer
{
text-align:center;
width: 100%;
}
.oneThirdContainer {
width: 300px;
float: left;
}
.clear {
clear: both;
}
</style>
<div id="pgCenter">
<form id="form1" runat="server">
<div id="container">
<div id="header">
here is my header
</div>
<div class="oneThirdContainer">
<p>This is where the login control goes. For testing purposes, I'll just throw some text in here.</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2mid - And here is some more placehold text so that I can see how this div is laying out!
I should also write some more text here because I still don't see anything going on :(</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2side - What else do you want me to put? I can't even think of anything right now except
eating some bomb delicious wingstop. I can't wait to get my paws on those saucy spicy cajun flavored mudda fuggas!</p>
</div>
<div class="clear"></div>
<div id="footer">
<p>(footer) Copyright © 2011</p>
</div>
</div>
</form>
</div>
</body>
所有这些变化:你做得太多了
#pgCenter
{
text-align:center;
margin: 20px;
}
#container
{
text-align:left;
width: 960px;
margin: 0 auto;
}
#header
{
width:100%;
text-align:center;
}
#footer
{
text-align:center;
width: 100%;
}
.oneThirdContainer {
width: 300px;
float: left;
}
.clear {
clear: both;
}
</style>
<div id="pgCenter">
<form id="form1" runat="server">
<div id="container">
<div id="header">
here is my header
</div>
<div class="oneThirdContainer">
<p>This is where the login control goes. For testing purposes, I'll just throw some text in here.</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2mid - And here is some more placehold text so that I can see how this div is laying out!
I should also write some more text here because I still don't see anything going on :(</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2side - What else do you want me to put? I can't even think of anything right now except
eating some bomb delicious wingstop. I can't wait to get my paws on those saucy spicy cajun flavored mudda fuggas!</p>
</div>
<div class="clear"></div>
<div id="footer">
<p>(footer) Copyright © 2011</p>
</div>
</div>
</form>
</div>
</body>
#pgCenter
{
text-align:center;
margin: 20px;
}
#container
{
text-align:left;
width: 960px;
margin: 0 auto;
}
#header
{
width:100%;
text-align:center;
}
#footer
{
text-align:center;
width: 100%;
}
.oneThirdContainer {
width: 300px;
float: left;
}
.clear {
clear: both;
}
</style>
<div id="pgCenter">
<form id="form1" runat="server">
<div id="container">
<div id="header">
here is my header
</div>
<div class="oneThirdContainer">
<p>This is where the login control goes. For testing purposes, I'll just throw some text in here.</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2mid - And here is some more placehold text so that I can see how this div is laying out!
I should also write some more text here because I still don't see anything going on :(</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2side - What else do you want me to put? I can't even think of anything right now except
eating some bomb delicious wingstop. I can't wait to get my paws on those saucy spicy cajun flavored mudda fuggas!</p>
</div>
<div class="clear"></div>
<div id="footer">
<p>(footer) Copyright © 2011</p>
</div>
</div>
</form>
</div>
</body>
#pgCenter
{
文本对齐:居中;
利润率:20px;
}
#容器
{
文本对齐:左对齐;
宽度:960px;
保证金:0自动;
}
#标题
{
宽度:100%;
文本对齐:居中;
}
#页脚
{
文本对齐:居中;
宽度:100%;
}
.第三个容器{
宽度:300px;
浮动:左;
}
.清楚{
明确:两者皆有;
}
这是我的头
这就是登录控件的位置。出于测试目的,我将在这里输入一些文本
#pgCenter
{
text-align:center;
margin: 20px;
}
#container
{
text-align:left;
width: 960px;
margin: 0 auto;
}
#header
{
width:100%;
text-align:center;
}
#footer
{
text-align:center;
width: 100%;
}
.oneThirdContainer {
width: 300px;
float: left;
}
.clear {
clear: both;
}
</style>
<div id="pgCenter">
<form id="form1" runat="server">
<div id="container">
<div id="header">
here is my header
</div>
<div class="oneThirdContainer">
<p>This is where the login control goes. For testing purposes, I'll just throw some text in here.</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2mid - And here is some more placehold text so that I can see how this div is laying out!
I should also write some more text here because I still don't see anything going on :(</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2side - What else do you want me to put? I can't even think of anything right now except
eating some bomb delicious wingstop. I can't wait to get my paws on those saucy spicy cajun flavored mudda fuggas!</p>
</div>
<div class="clear"></div>
<div id="footer">
<p>(footer) Copyright © 2011</p>
</div>
</div>
</form>
</div>
</body>
内部DIV ID:col2mid-这里还有一些placehold文本,以便我可以看到这个DIV是如何布局的!
我还应该在这里多写一些文字,因为我仍然没有看到任何进展:(
#pgCenter
{
text-align:center;
margin: 20px;
}
#container
{
text-align:left;
width: 960px;
margin: 0 auto;
}
#header
{
width:100%;
text-align:center;
}
#footer
{
text-align:center;
width: 100%;
}
.oneThirdContainer {
width: 300px;
float: left;
}
.clear {
clear: both;
}
</style>
<div id="pgCenter">
<form id="form1" runat="server">
<div id="container">
<div id="header">
here is my header
</div>
<div class="oneThirdContainer">
<p>This is where the login control goes. For testing purposes, I'll just throw some text in here.</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2mid - And here is some more placehold text so that I can see how this div is laying out!
I should also write some more text here because I still don't see anything going on :(</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2side - What else do you want me to put? I can't even think of anything right now except
eating some bomb delicious wingstop. I can't wait to get my paws on those saucy spicy cajun flavored mudda fuggas!</p>
</div>
<div class="clear"></div>
<div id="footer">
<p>(footer) Copyright © 2011</p>
</div>
</div>
</form>
</div>
</body>
INSIDE DIV ID:col2side-你还想让我放什么?我现在甚至想不出什么,除了
吃了些美味的鸡翅。我迫不及待地想把我的爪子放在那些辣辣的卡琼口味的穆达浓烟上
#pgCenter
{
text-align:center;
margin: 20px;
}
#container
{
text-align:left;
width: 960px;
margin: 0 auto;
}
#header
{
width:100%;
text-align:center;
}
#footer
{
text-align:center;
width: 100%;
}
.oneThirdContainer {
width: 300px;
float: left;
}
.clear {
clear: both;
}
</style>
<div id="pgCenter">
<form id="form1" runat="server">
<div id="container">
<div id="header">
here is my header
</div>
<div class="oneThirdContainer">
<p>This is where the login control goes. For testing purposes, I'll just throw some text in here.</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2mid - And here is some more placehold text so that I can see how this div is laying out!
I should also write some more text here because I still don't see anything going on :(</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2side - What else do you want me to put? I can't even think of anything right now except
eating some bomb delicious wingstop. I can't wait to get my paws on those saucy spicy cajun flavored mudda fuggas!</p>
</div>
<div class="clear"></div>
<div id="footer">
<p>(footer) Copyright © 2011</p>
</div>
</div>
</form>
</div>
</body>
(页脚)版权所有©2011
#pgCenter
{
text-align:center;
margin: 20px;
}
#container
{
text-align:left;
width: 960px;
margin: 0 auto;
}
#header
{
width:100%;
text-align:center;
}
#footer
{
text-align:center;
width: 100%;
}
.oneThirdContainer {
width: 300px;
float: left;
}
.clear {
clear: both;
}
</style>
<div id="pgCenter">
<form id="form1" runat="server">
<div id="container">
<div id="header">
here is my header
</div>
<div class="oneThirdContainer">
<p>This is where the login control goes. For testing purposes, I'll just throw some text in here.</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2mid - And here is some more placehold text so that I can see how this div is laying out!
I should also write some more text here because I still don't see anything going on :(</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2side - What else do you want me to put? I can't even think of anything right now except
eating some bomb delicious wingstop. I can't wait to get my paws on those saucy spicy cajun flavored mudda fuggas!</p>
</div>
<div class="clear"></div>
<div id="footer">
<p>(footer) Copyright © 2011</p>
</div>
</div>
</form>
</div>
</body>
你做得太多了
#pgCenter
{
text-align:center;
margin: 20px;
}
#container
{
text-align:left;
width: 960px;
margin: 0 auto;
}
#header
{
width:100%;
text-align:center;
}
#footer
{
text-align:center;
width: 100%;
}
.oneThirdContainer {
width: 300px;
float: left;
}
.clear {
clear: both;
}
</style>
<div id="pgCenter">
<form id="form1" runat="server">
<div id="container">
<div id="header">
here is my header
</div>
<div class="oneThirdContainer">
<p>This is where the login control goes. For testing purposes, I'll just throw some text in here.</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2mid - And here is some more placehold text so that I can see how this div is laying out!
I should also write some more text here because I still don't see anything going on :(</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2side - What else do you want me to put? I can't even think of anything right now except
eating some bomb delicious wingstop. I can't wait to get my paws on those saucy spicy cajun flavored mudda fuggas!</p>
</div>
<div class="clear"></div>
<div id="footer">
<p>(footer) Copyright © 2011</p>
</div>
</div>
</form>
</div>
</body>
#pgCenter
{
文本对齐:居中;
利润率:20px;
}
#容器
{
文本对齐:左对齐;
宽度:960px;
保证金:0自动;
}
#标题
{
宽度:100%;
文本对齐:居中;
}
#页脚
{
文本对齐:居中;
宽度:100%;
}
.第三个容器{
宽度:300px;
浮动:左;
}
.清楚{
明确:两者皆有;
}
这是我的头
这就是登录控件的位置。出于测试目的,我将在这里输入一些文本
#pgCenter
{
text-align:center;
margin: 20px;
}
#container
{
text-align:left;
width: 960px;
margin: 0 auto;
}
#header
{
width:100%;
text-align:center;
}
#footer
{
text-align:center;
width: 100%;
}
.oneThirdContainer {
width: 300px;
float: left;
}
.clear {
clear: both;
}
</style>
<div id="pgCenter">
<form id="form1" runat="server">
<div id="container">
<div id="header">
here is my header
</div>
<div class="oneThirdContainer">
<p>This is where the login control goes. For testing purposes, I'll just throw some text in here.</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2mid - And here is some more placehold text so that I can see how this div is laying out!
I should also write some more text here because I still don't see anything going on :(</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2side - What else do you want me to put? I can't even think of anything right now except
eating some bomb delicious wingstop. I can't wait to get my paws on those saucy spicy cajun flavored mudda fuggas!</p>
</div>
<div class="clear"></div>
<div id="footer">
<p>(footer) Copyright © 2011</p>
</div>
</div>
</form>
</div>
</body>
内部DIV ID:col2mid-这里还有一些placehold文本,以便我可以看到这个DIV是如何布局的!
我还应该在这里多写一些文字,因为我仍然没有看到任何进展:(
#pgCenter
{
text-align:center;
margin: 20px;
}
#container
{
text-align:left;
width: 960px;
margin: 0 auto;
}
#header
{
width:100%;
text-align:center;
}
#footer
{
text-align:center;
width: 100%;
}
.oneThirdContainer {
width: 300px;
float: left;
}
.clear {
clear: both;
}
</style>
<div id="pgCenter">
<form id="form1" runat="server">
<div id="container">
<div id="header">
here is my header
</div>
<div class="oneThirdContainer">
<p>This is where the login control goes. For testing purposes, I'll just throw some text in here.</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2mid - And here is some more placehold text so that I can see how this div is laying out!
I should also write some more text here because I still don't see anything going on :(</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2side - What else do you want me to put? I can't even think of anything right now except
eating some bomb delicious wingstop. I can't wait to get my paws on those saucy spicy cajun flavored mudda fuggas!</p>
</div>
<div class="clear"></div>
<div id="footer">
<p>(footer) Copyright © 2011</p>
</div>
</div>
</form>
</div>
</body>
INSIDE DIV ID:col2side-你还想让我放什么?我现在甚至想不出什么,除了
吃了些美味的鸡翅。我迫不及待地想把我的爪子放在那些辣辣的卡琼口味的穆达浓烟上
#pgCenter
{
text-align:center;
margin: 20px;
}
#container
{
text-align:left;
width: 960px;
margin: 0 auto;
}
#header
{
width:100%;
text-align:center;
}
#footer
{
text-align:center;
width: 100%;
}
.oneThirdContainer {
width: 300px;
float: left;
}
.clear {
clear: both;
}
</style>
<div id="pgCenter">
<form id="form1" runat="server">
<div id="container">
<div id="header">
here is my header
</div>
<div class="oneThirdContainer">
<p>This is where the login control goes. For testing purposes, I'll just throw some text in here.</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2mid - And here is some more placehold text so that I can see how this div is laying out!
I should also write some more text here because I still don't see anything going on :(</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2side - What else do you want me to put? I can't even think of anything right now except
eating some bomb delicious wingstop. I can't wait to get my paws on those saucy spicy cajun flavored mudda fuggas!</p>
</div>
<div class="clear"></div>
<div id="footer">
<p>(footer) Copyright © 2011</p>
</div>
</div>
</form>
</div>
</body>
(页脚)版权所有©2011
#pgCenter
{
text-align:center;
margin: 20px;
}
#container
{
text-align:left;
width: 960px;
margin: 0 auto;
}
#header
{
width:100%;
text-align:center;
}
#footer
{
text-align:center;
width: 100%;
}
.oneThirdContainer {
width: 300px;
float: left;
}
.clear {
clear: both;
}
</style>
<div id="pgCenter">
<form id="form1" runat="server">
<div id="container">
<div id="header">
here is my header
</div>
<div class="oneThirdContainer">
<p>This is where the login control goes. For testing purposes, I'll just throw some text in here.</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2mid - And here is some more placehold text so that I can see how this div is laying out!
I should also write some more text here because I still don't see anything going on :(</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2side - What else do you want me to put? I can't even think of anything right now except
eating some bomb delicious wingstop. I can't wait to get my paws on those saucy spicy cajun flavored mudda fuggas!</p>
</div>
<div class="clear"></div>
<div id="footer">
<p>(footer) Copyright © 2011</p>
</div>
</div>
</form>
</div>
</body>
与其试图指出我认为你的错误,不如让你看看我会怎么做
#pgCenter
{
text-align:center;
margin: 20px;
}
#container
{
text-align:left;
width: 960px;
margin: 0 auto;
}
#header
{
width:100%;
text-align:center;
}
#footer
{
text-align:center;
width: 100%;
}
.oneThirdContainer {
width: 300px;
float: left;
}
.clear {
clear: both;
}
</style>
<div id="pgCenter">
<form id="form1" runat="server">
<div id="container">
<div id="header">
here is my header
</div>
<div class="oneThirdContainer">
<p>This is where the login control goes. For testing purposes, I'll just throw some text in here.</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2mid - And here is some more placehold text so that I can see how this div is laying out!
I should also write some more text here because I still don't see anything going on :(</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2side - What else do you want me to put? I can't even think of anything right now except
eating some bomb delicious wingstop. I can't wait to get my paws on those saucy spicy cajun flavored mudda fuggas!</p>
</div>
<div class="clear"></div>
<div id="footer">
<p>(footer) Copyright © 2011</p>
</div>
</div>
</form>
</div>
</body>
基本上,您描述的是3行,中间一行分为3列
#pgCenter
{
text-align:center;
margin: 20px;
}
#container
{
text-align:left;
width: 960px;
margin: 0 auto;
}
#header
{
width:100%;
text-align:center;
}
#footer
{
text-align:center;
width: 100%;
}
.oneThirdContainer {
width: 300px;
float: left;
}
.clear {
clear: both;
}
</style>
<div id="pgCenter">
<form id="form1" runat="server">
<div id="container">
<div id="header">
here is my header
</div>
<div class="oneThirdContainer">
<p>This is where the login control goes. For testing purposes, I'll just throw some text in here.</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2mid - And here is some more placehold text so that I can see how this div is laying out!
I should also write some more text here because I still don't see anything going on :(</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2side - What else do you want me to put? I can't even think of anything right now except
eating some bomb delicious wingstop. I can't wait to get my paws on those saucy spicy cajun flavored mudda fuggas!</p>
</div>
<div class="clear"></div>
<div id="footer">
<p>(footer) Copyright © 2011</p>
</div>
</div>
</form>
</div>
</body>
<!-- HTML -->
<div id="header">header</div>
<div id="middle">
<div id="col1">col 1</div>
<div id="col2">col 2</div>
<div id="col3">col 3</div>
</div>
<div id="footer">footer</div>
这应该把col1
、col2
和col3
放在中间的内联。我包括边框只是为了举例说明它们的位置
#pgCenter
{
text-align:center;
margin: 20px;
}
#container
{
text-align:left;
width: 960px;
margin: 0 auto;
}
#header
{
width:100%;
text-align:center;
}
#footer
{
text-align:center;
width: 100%;
}
.oneThirdContainer {
width: 300px;
float: left;
}
.clear {
clear: both;
}
</style>
<div id="pgCenter">
<form id="form1" runat="server">
<div id="container">
<div id="header">
here is my header
</div>
<div class="oneThirdContainer">
<p>This is where the login control goes. For testing purposes, I'll just throw some text in here.</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2mid - And here is some more placehold text so that I can see how this div is laying out!
I should also write some more text here because I still don't see anything going on :(</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2side - What else do you want me to put? I can't even think of anything right now except
eating some bomb delicious wingstop. I can't wait to get my paws on those saucy spicy cajun flavored mudda fuggas!</p>
</div>
<div class="clear"></div>
<div id="footer">
<p>(footer) Copyright © 2011</p>
</div>
</div>
</form>
</div>
</body>
这就是简单的三列布局。虽然不是最优雅的,但也可以。要想获得更优雅的布局,请查看:
#pgCenter
{
text-align:center;
margin: 20px;
}
#container
{
text-align:left;
width: 960px;
margin: 0 auto;
}
#header
{
width:100%;
text-align:center;
}
#footer
{
text-align:center;
width: 100%;
}
.oneThirdContainer {
width: 300px;
float: left;
}
.clear {
clear: both;
}
</style>
<div id="pgCenter">
<form id="form1" runat="server">
<div id="container">
<div id="header">
here is my header
</div>
<div class="oneThirdContainer">
<p>This is where the login control goes. For testing purposes, I'll just throw some text in here.</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2mid - And here is some more placehold text so that I can see how this div is laying out!
I should also write some more text here because I still don't see anything going on :(</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2side - What else do you want me to put? I can't even think of anything right now except
eating some bomb delicious wingstop. I can't wait to get my paws on those saucy spicy cajun flavored mudda fuggas!</p>
</div>
<div class="clear"></div>
<div id="footer">
<p>(footer) Copyright © 2011</p>
</div>
</div>
</form>
</div>
</body>
与其试图指出我认为你的问题所在,不如让你看看我会怎么做
#pgCenter
{
text-align:center;
margin: 20px;
}
#container
{
text-align:left;
width: 960px;
margin: 0 auto;
}
#header
{
width:100%;
text-align:center;
}
#footer
{
text-align:center;
width: 100%;
}
.oneThirdContainer {
width: 300px;
float: left;
}
.clear {
clear: both;
}
</style>
<div id="pgCenter">
<form id="form1" runat="server">
<div id="container">
<div id="header">
here is my header
</div>
<div class="oneThirdContainer">
<p>This is where the login control goes. For testing purposes, I'll just throw some text in here.</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2mid - And here is some more placehold text so that I can see how this div is laying out!
I should also write some more text here because I still don't see anything going on :(</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2side - What else do you want me to put? I can't even think of anything right now except
eating some bomb delicious wingstop. I can't wait to get my paws on those saucy spicy cajun flavored mudda fuggas!</p>
</div>
<div class="clear"></div>
<div id="footer">
<p>(footer) Copyright © 2011</p>
</div>
</div>
</form>
</div>
</body>
基本上,您描述的是3行,中间一行分为3列
#pgCenter
{
text-align:center;
margin: 20px;
}
#container
{
text-align:left;
width: 960px;
margin: 0 auto;
}
#header
{
width:100%;
text-align:center;
}
#footer
{
text-align:center;
width: 100%;
}
.oneThirdContainer {
width: 300px;
float: left;
}
.clear {
clear: both;
}
</style>
<div id="pgCenter">
<form id="form1" runat="server">
<div id="container">
<div id="header">
here is my header
</div>
<div class="oneThirdContainer">
<p>This is where the login control goes. For testing purposes, I'll just throw some text in here.</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2mid - And here is some more placehold text so that I can see how this div is laying out!
I should also write some more text here because I still don't see anything going on :(</p>
</div>
<div class="oneThirdContainer">
<p>INSIDE DIV ID:col2side - What else do you want me to put? I can't even think of anything right now except
eating some bomb delicious wingstop. I can't wait to get my paws on those saucy spicy cajun flavored mudda fuggas!</p>
</div>
<div class="clear"></div>
<div id="footer">
<p>(footer) Copyright © 2011</p>
</div>
</div>
</form>
</div>
</body>
<!-- HTML -->
<div id="header">header</div>
<div id="middle">
<div id="col1">col 1</div>
<div id="col2">col 2</div>
<div id="col3">col 3</div>
</div>
<div id="footer">footer</div>
这应该是col1