求助 我的運行結果總是錯的
我的運行結果是這樣,文字不在圖片里面,大神幫忙看下哪兒錯了
/*下面是任務部分*/
#box3{
? ? width:200px;
? ? height:200px;
? ? position:relative; ? ? ??
}
#box4{
? ? width:200px;
? ? height:50px;
? position:absolute;
bottom:0px;
? ??
}
</style>
</head>
<body>
<div id="box1">
<div id="box2">相對參照元素進行定位</div>
</div>
<h1>下面是任務部分</h1>
<div id="box3"><img src="http://img1.sycdn.imooc.com//541a7d8a00018cf102000200.jpg" >
? ? <div id="box4">當我還是三年級的學生時是一個害羞的小女生。</div>
</div>
</body>
</html>
2017-01-09
同學,打代碼要嚴謹!我找到你的錯誤所在了,注意看這是你自己寫的代碼:
#box3{
? ? width:200px;
? ? height:200px;
? ? position:relative; ? ? ??
}
問題就出在這個relative前面的冒號上,你打成全角冒號了,所以這個position定為就沒起作用,你把冒號換成半角的試試就知道了!
2017-01-08
改top和left屬性的px大小啊,調(diào)整到合適就好了
2017-01-07
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>相對參照元素進行定位</title>
<style type="text/css">
div{border:2px red solid;}
#box1{
? ? width:200px;
? ? height:200px;
? ? position:relative;
? ? ? ? ??
}
#box2{
? position:absolute;
top:20px;
left:30px;
? ? ? ? ??
}
/*下面是任務部分*/
#box3{
? ? width:200px;
? ? height:200px;
? ? position:relative; ? ? ??
}
#box4{
? ? width:99%;
? position:absolute;
top:163px;
}
</style>
</head>
<body>
<div id="box1">
<div id="box2">相對參照元素進行定位</div>
</div>
<h1>下面是任務部分</h1>
<div id="box3">
? ? <img src="http://img1.sycdn.imooc.com//541a7d8a00018cf102000200.jpg">
? ? <div id="box4">當我還是三年級的學生時是一個害羞的小女生。</div>
</div>
</body>
</html>