求助 我的運(yùn)行結(jié)果總是錯(cuò)的
我的運(yùn)行結(jié)果是這樣,文字不在圖片里面,大神幫忙看下哪兒錯(cuò)了
/*下面是任務(wù)部分*/
#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">相對(duì)參照元素進(jìn)行定位</div>
</div>
<h1>下面是任務(wù)部分</h1>
<div id="box3"><img src="http://img1.sycdn.imooc.com//541a7d8a00018cf102000200.jpg" >
? ? <div id="box4">當(dāng)我還是三年級(jí)的學(xué)生時(shí)是一個(gè)害羞的小女生。</div>
</div>
</body>
</html>
2017-01-09
同學(xué),打代碼要嚴(yán)謹(jǐn)!我找到你的錯(cuò)誤所在了,注意看這是你自己寫的代碼:
#box3{
? ? width:200px;
? ? height:200px;
? ? position:relative; ? ? ??
}
問(wèn)題就出在這個(gè)relative前面的冒號(hào)上,你打成全角冒號(hào)了,所以這個(gè)position定為就沒(méi)起作用,你把冒號(hào)換成半角的試試就知道了!
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>相對(duì)參照元素進(jìn)行定位</title>
<style type="text/css">
div{border:2px red solid;}
#box1{
? ? width:200px;
? ? height:200px;
? ? position:relative;
? ? ? ? ??
}
#box2{
? position:absolute;
top:20px;
left:30px;
? ? ? ? ??
}
/*下面是任務(wù)部分*/
#box3{
? ? width:200px;
? ? height:200px;
? ? position:relative; ? ? ??
}
#box4{
? ? width:99%;
? position:absolute;
top:163px;
}
</style>
</head>
<body>
<div id="box1">
<div id="box2">相對(duì)參照元素進(jìn)行定位</div>
</div>
<h1>下面是任務(wù)部分</h1>
<div id="box3">
? ? <img src="http://img1.sycdn.imooc.com//541a7d8a00018cf102000200.jpg">
? ? <div id="box4">當(dāng)我還是三年級(jí)的學(xué)生時(shí)是一個(gè)害羞的小女生。</div>
</div>
</body>
</html>