I have one html and css that I want to make sure children elements svg
and 2 <p>
elements centered both vertically and horizontally. I have tried align-items justify-content
on my parent element it works. But it also change the other properties. so is it possible to set up the child element ONLY
on child element css level
html file
<div class="container">
<div class="box">
<svg width="100" height="100">
<circle cx="50" cy="50" r="40" stroke="green" stroke-width="4" fill="yellow" />
Sorry, your browser does not support inline SVG.
</svg>
<p>it should be center</p>
<p>it should be center on vertical</p>
</div>
</div>
css file
// center horizontally. styles on parent
.container {
height: 500px;
width: 700px;
display: flex;
border: 1px solid #000000;
}
.box {
align-self: center;
align-items: center;
justify-content: center;
}