Home >Web Front-end >CSS Tutorial >Detailed introduction to the default position of child tags in css parent tags

Detailed introduction to the default position of child tags in css parent tags

高洛峰
高洛峰Original
2017-03-20 16:29:531601browse

This article shares a detailed introduction to the default position of the child tag in the css parent tag

<!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>

If you do not set top and left for the b tag. They will have a default value.

top and left will be positioned based on width and height.

The above is the detailed content of Detailed introduction to the default position of child tags in css parent tags. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn