I have a problem with the alignment of my child divs. Is it possible to align them if the child elements were separated? I tried display: flex; and grids but nothing happened. What I want is to make the "title box" height equally. Sorry for my bad explanation, I am not a native English speaker.
body {
display: flex;
align-items: center;
justify-content: center;
height: 100vh;
}
.box-container {
display: flex;
gap: 10px;
}
.box {
height: 100%;
height: inherit;
border: 2px solid green;
width: 300px;
padding: 5px;
}
.box-title {
text-align: center;
border: 1px solid red;
}
.text {
color: blue;
text-align: center;
}
button {
width: 100%;
margin: 0 auto;
}
<body>
<div class="box-container">
<div class="box">
<div class="box-title">
<h1>This is a loooooonnnnggggg title</h1>
</div>
<div>
<p class="text">this should be aligned with the other div</p>
<button>this should be aligned with the other div</button>
</div>
</div>
<div class="box">
<div class="box-title">
<h1>Title</h1>
</div>
<div>
<p class="text">this should be aligned with the other div</p>
<button>this should be aligned with the other div</button>
</div>
</div>
<div class="box">
<div class="box-title">
<h1>Title</h1>
</div>
<div>
<p class="text">this should be aligned with the other div</p>
<button>this should be aligned with the other div</button>
</div>
</div>
</div>
</body>