我是一个相对较新的CSS .And,我在我的页面布局中面临以下问题。
我看过其他帖子,但没有找到答案。问题是当我指定
位置:在#logo #logoimg内的绝对位置,它不加载。但是,如果我删除
位置:绝对#logoimg正确加载。我正在尝试学习如何通过以下方式定位div
在相对div中创建绝对div。
我的html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>New Web Project</title>
<link rel="stylesheet" href="style.css" type="text/css" media="screen" charset="utf-8"/>
</head>
<body>
<div id = "wrapper">
<div id = "header"> <img src="images/banner.png" /> </div>
<div id = "content">
<div id="logo">
<div id="logoimg" > czcz </div>
</div>
</div>
</div>
</body>
</html>我的CSS
body {
margin: 0;
padding: 0;
}
#header {
background: url('images/banner_tile.jpg') ;
height: 96px;
width: 100% ;
}
#header img {
display:block;
margin: auto ;
}
#content img {
display:block;
margin: auto ;
}
#content {
/*overflow:auto ;*/
background: url('images/body_tile.png') ;
height: 100% ;
width: 100% ;
}
#logo { position:relative; height: 100px ; }
#logo #logoimg {
position:absolute ;
top:300px ;
left:700px ;
width:398px ;
height:200px ;
background: url('images/body_sprite.png');
z-index: 1;
}发布于 2012-08-03 22:07:09
给你玩的猴子的一个整洁的小提琴:http://jsfiddle.net/TjQLf/
https://stackoverflow.com/questions/11797269
复制相似问题