CSS div标题宽度don’;t显示100%。
如果我放大浏览器,那么我的div标题宽度不会显示100%。但我将div标题宽度设置为100%。请有人指出我可能做错了什么?非常感谢。这是我的密码:CSS div标题宽度don’;t显示100%。,css,html,Css,Html,如果我放大浏览器,那么我的div标题宽度不会显示100%。但我将div标题宽度设置为100%。请有人指出我可能做错了什么?非常感谢。这是我的密码: <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>Welcome Page</title> <link rel="shortcut icon"
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Welcome Page</title>
<link rel="shortcut icon" href="image/icon.ico" >
<link rel="StyleSheet" href="style/login.css" type="text/css"/>
</head>
<body>
<div id="header">
<div id="header_contain">
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td width="50%" style="font-size: 18pt; font-weight: bold">Hello</td>
<td width="50%" align="right" style="font-size: 18pt; font-weight: bold">What's Up!</td>
</tr>
</table>
</div>
</div>
</body>
</html>
您需要将
上方的每个元素设置为100%宽度,包括
标记。我已经编辑了我的代码并测试了它
<div id="header" style="width:1500px;">
<div id="header_contain" style="min-width:980px;">
<table>
<tr>
<td>
<div style="width:500px;">
Hie, Div1 Content Here.!!
</div>
</td>
<td>
<div style="width:500px;">
Hie, Div2 Content Here.!!
</div>
</td>
<td>
<div style="width:500px;">
Hie, Div3 Content Here.!!
</div>
</td>
</tr>
</table>
</div>
</div>
如果这对你有帮助,那么别忘了提高你的接受率。干杯 我在header\u contain div上使用了我在head div中已经使用过的相同颜色,这样我就解决了这个问题
#header
width: 100%;
height: 85px;
background: #006666;
position:fixed;
z-index:999;
top:0;}
#header
{
width: 100%;
height: 85px;
background: #006666;
}
#header_contain
{
color: white;
width: 980px;
height: 85px;
background: #006666;
margin: 0px auto;
padding-top: 30px;
}
对我来说很好,你试过改变浏览器吗?代码很好。。。默认情况下,所有块级元素都会拉伸到100%宽度,您甚至不需要设置宽度:100%才能正常工作。提供的代码已按预期工作。可能还需要其他功能?我使用的是firefox的最新版本。事实上,我想创建两个div,第一个是100%拉伸的div,然后在里面放置另一个div,并将其宽度设置为980px,谢谢你的重放。我使用你的代码,但如果我拉伸到100%,滚动条就不会显示。实际上,我想创建一个类似facebook的标题。Facebook标题colo div为100%,但Facebook名称和其他信息设置为980px div。
#header
width: 100%;
height: 85px;
background: #006666;
position:fixed;
z-index:999;
top:0;}
#header
{
width: 100%;
height: 85px;
background: #006666;
}
#header_contain
{
color: white;
width: 980px;
height: 85px;
background: #006666;
margin: 0px auto;
padding-top: 30px;
}