九热精品I亚洲电影第一页avI精品在线播放I成人av在线影视I日韩中文字幕视频在线观看I97精品国产一二三产区I色干综合

css-父標簽中的子標簽默認位置

2016/12/1 8:46:09   閱讀:1928    發布者:1928

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<style>
.a{
width: 100px;
height: 100px;
background: red;
position: relative;
top: 40px;
left: 50px;
padding: 30px;
}
.b{
width: 50px;
height: 50px;
background: bisque;
position: absolute;
}
</style>
</head>
<body>
<div class="a">
<div class="b"></div>
</div>
</body>
</html>

 

 

如果不給b標簽設定top和left。他們會有個默認的值。

top和left會以width和height為基礎進行定位。