In child-container 1 I would like the two grandchildren divs to behave indepedently. Aim: Grandchild 1: Left top Grandchild 2: Center spanning entire width.
=Centering grandchild 2 works fine. However, when I add grandchild 1 it behaves according to the container, cutting into the width of grandchild 2 sitting on the same line. How can I move grandchild 1 to the top left?
* {
padding: 0;
margin: 0;
box-sizing: border-box;
}
.child1 {
background-color: blue;
height: 10rem;
display: flex;
justify-content: center;
align-items: center;
}
.child2 {
background-color: red;
height: 10rem;
}
.child3 {
background-color: green;
height: 10rem;
}
.grandchild1 {
background-color: yellow;
}
.grandchild2 {
background-color: purple;
border: 1px black solid;
flex-grow: 1;
text-align: center;
}
<html>
<body>
<div class="parent">
<div class="child1">
<div class="grandchild1">
<h1>Top-Left Me</h1>
</div>
<div class="grandchild2">
<h1>Center Me Entire Width</h1>
</div>
</div>
<div class="child2">
<h1>.</h1>
</div>
<div class="child3">
<h1>.</h1>
</div>
</div>
</body>
</html>