I want to take an element outside of the normal HTML flow so that I can position it properly. So tried Absolute positioning, it positions the element according to its parent rules. Due to some height and width constraints, I'm not able to position it, at the most higher level so that it takes 100% of width and height, without affecting their parent's divs.
Example Code:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
.Parent3 {
width: 800px;
height: 340px;
background: blueviolet;
position: relative;
}
.Parent2 {
width: 600px;
height: 300px;
background: chocolate;
position: absolute
}
.Parent1 {
width: 400px;
height: 260px;
background: darkcyan;
}
.Parent0 {
width: 200px;
height: 220px;
background: dimgray;
position: absolute;
right: 0px;
}
</style>
</head>
<body>
<div Class="Parent3">
<div Class="Parent2">
<div Class="Parent1">
<div class="Parent0">
<h1> The element needs to be positioned</h1>
</div>
</div>
</div>
</div>
</body>
</html>
Due to the absolute positioning, DIV 4 is ejected from the flow, and it can be a position anywhere inside the Parent1 DIV. but I want to position it by using the heights & widths of Parent3 DIV, without changing the position properties of their parents. Please help me or advised another way.