作者lonelytea (霸氣逼人)
看板Web_Design
標題[問題] position
時間Thu Jun 4 22:22:14 2015
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
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 220.132.215.253
※ 文章網址: https://www.ptt.cc/bbs/Web_Design/M.1433427736.A.62E.html
推 oToToT: 因為你兩張圖都設position:absolute他就缺少實體高度了 06/04 22:31
→ oToToT: 你會發現#title的height變成0了,因為它裡面沒有東西撐開 06/04 22:31
I did it!! I set height for #title , 3Q~~~~
→ oToToT: 還有你在#title的CSS那少了結尾} 06/04 22:32
Just lose to copy XD
※ 編輯: lonelytea (220.132.215.253), 06/04/2015 22:37:28