css父标签中的子标签默认位置详细介绍

这篇文章分享css父标签中的子标签默认位置详细介绍

<!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>
<p class="a">
<p class="b"></p>
</p>
</body>
</html>

如果不给b标签设定top和left。他们会有个默认的值。

top和left会以width和height为基础进行定位。

以上就是css父标签中的子标签默认位置详细介绍的详细内容,更多请关注其它相关文章!

css父标签中的子标签默认位置详细介绍

相关文章:

你感兴趣的文章:

标签云: