Hi everyone,
My code consists of 2 elements. "One" is the ancestor and "second" is child.
I try to place "second" at the bottom of "one" in the middle of its' width.
here is my code:
The attached screenshot displays the result: "second" is placed at the bottom of "one" but fails to be at its' middle.
Could anyone tell me why?>
Thanks.
My code consists of 2 elements. "One" is the ancestor and "second" is child.
I try to place "second" at the bottom of "one" in the middle of its' width.
here is my code:
Code:
[img]https://res.cloudinary.com/engineering-com/image/upload/v1490266656/tips/to_forum_dnvy8n.gif[/img]
<!DOCTYPE html>
<html>
<head>
<style>
.one
{ position:relative; border: 2px solid green; height: 200px; width: 50%; }
.second{ position: absolute; border: 2px solid red; width: 50%; bottom: 0; margin: auto; }
</style>
</head>
<body>
<div class="one">one
<div class="second">second<div>
</div>
</body>]
Could anyone tell me why?>
Thanks.