mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 19:38:12 +00:00

When a box does not have a top, left, bottom, or right, there is no need to adjust the offset for positioning relative to the padding edge, because the box remains in the normal flow.
20 lines
No EOL
363 B
HTML
20 lines
No EOL
363 B
HTML
<!DOCTYPE html><style>
|
|
* {
|
|
border: 1px solid black;
|
|
}
|
|
|
|
.box {
|
|
position: relative;
|
|
padding: 10px 50px 100px 20px;
|
|
background-color: mediumseagreen;
|
|
width: 200px;
|
|
height: 200px;
|
|
}
|
|
|
|
.inner {
|
|
position: absolute;
|
|
width : 100px;
|
|
height: 100px;
|
|
background-color: magenta;
|
|
}
|
|
</style><div class="box"><div class="inner"></div></div> |