[问题] position

楼主: lonelytea (霸气逼人)   2015-06-04 22:22:14
Sorry I have some problem cant type chinese
<!DOCTYPE html>
<html>
<head>
<title> newsweb</title>
<meta charset="UTF-8">
<meta name="author" content="Pascal">
<style type="text/css">
#web_header {
position: relative;
height: 32em;
background-color: pink;}
#title {
width: 80%;
background-color: red;
/* why lose background*/
border-radius: 0px 0px 10px 10px;
position: absolute;
left: 10%;
top: 0px;
#titleimg1 {
position: absolute;
left: 5%;}
#titleimg2 {
/* position: absolute;
right: 5%;*/}
</style>
</head>
<body>
<div id="web_header">123
<div id="title">
<div id="titleimg1"><img src="web_file/mooktit.png"></div>
<div id="titleimg2"><img src="web_file/logo_gamme.png"></div>
</div>
</div>
</body>
</html>
If I set up #titleimg2 position
I will lose #web_header background
How to make it work~~~
thanks
作者: oToToT (屁孩)   2015-06-04 22:31:00
因为你两张图都设position:absolute他就缺少实体高度了你会发现#title的height变成0了,因为它里面没有东西撑开还有你在#title的CSS那少了结尾}

Links booklink

Contact Us: admin [ a t ] ucptt.com