Home >Web Front-end >CSS Tutorial >Detailed introduction to the default position of child tags in css parent tags
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!