|
查看: 1040|回复: 8
|
关于div的问题
[复制链接]
|
|
|
|
各位高手请帮帮忙,小弟我刚才把content这div放了float: left后就不能置中了,margin有放auto,请问是什么问题?? |
|
|
|
|
|
|
|
|
|
|
发表于 5-12-2010 08:59 PM
|
显示全部楼层
|
|
|
|
|
|
|
|
|
|

楼主 |
发表于 5-12-2010 09:55 PM
|
显示全部楼层
回复 2# vampcheah
应该是吧,因为content里有contentL和contentR,因为要把contentL放在左边就用float: left,不过放了之后conten就怎样都弄不去中间了~~ |
|
|
|
|
|
|
|
|
|
|
发表于 6-12-2010 11:55 AM
|
显示全部楼层
有没有漏了放这个:
body {
text-align:center;
} |
|
|
|
|
|
|
|
|
|
|
发表于 6-12-2010 04:00 PM
|
显示全部楼层
|
我建议你把code paste在帖里, 不然很难明白 |
|
|
|
|
|
|
|
|
|
|

楼主 |
发表于 6-12-2010 07:48 PM
|
显示全部楼层
|
|
|
|
|
|
|
|
|
|

楼主 |
发表于 6-12-2010 07:51 PM
|
显示全部楼层
这个是css里的
- #header {
- background-image: url(Untitled-1.jpg);
- background-repeat: no-repeat;
- height: 208px;
- width: 1100px;
- margin-right: auto;
- margin-left: auto;
- }
- #content {
- background-image: url(Untitled-1-1.jpg);
- background-repeat: repeat-y;
- width: 1100px;
- float: left;
- margin-right: auto;
- margin-left: auto;
- text-align: center;
- }
- #footer {
- height: 50px;
- width: 1100px;
- background-image: url(Untitled-1-2.jpg);
- background-repeat: no-repeat;
- clear: left;
- margin-right: auto;
- margin-left: auto;
- }
- #contentL {
- float: left;
- width: 230px;
- }
- #contentR {
- margin-left: 230px;
- }#R {
- text-align: right;
- }
复制代码
这个是html里的
-
- <!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>Untitled Document</title>
- <link href="Files/css.css" rel="stylesheet" type="text/css" />
- </head>
- <body>
- <div id="header">
- <div id="R"><br />
- <p><a href="register.php">注册</a>
- <a href="login.php">登入</a> </p>
- </div>
- </div>
- <div id="content">
- <div id="contentL">
-
- Content for id "contentL" Goes Here</div>
- <div id="contentR">Content for id "contentR" Goes Here</div>
- Content for id "content" Goes Here</div>
- <div id="footer">Content for id "footer" Goes Here</div>
- </body>
- </html>
复制代码 |
|
|
|
|
|
|
|
|
|
|
发表于 6-12-2010 08:55 PM
|
显示全部楼层
把css的line 13去除掉就可以了。
你要把#contentL放在左边就在#contentL里用float: left就够了。
不需要在#content里再加float:left。 |
|
|
|
|
|
|
|
|
|
|

楼主 |
发表于 7-12-2010 05:37 PM
|
显示全部楼层
|
|
|
|
|
|
|
|
| |
本周最热论坛帖子
|