每当我在网格布局中插入SVG时,它1)不会居中,2)会打断网格的布局.我该如何解决这个问题,以便播放图标以播放文本相同的方式显示.
以下是正在 destruct 的布局:
.body { background-color: hsl(0,0%,10%); color: white; font-size: 32px; }
.center_children { display: flex; justify-content: center; }
.timer
{
width: 12rem; height: 12rem; border-radius: 50%;
background-color: hsl(0, 50%, 50%);
display:grid; grid-template-rows: 2fr 1fr; gap: 1.5rem;
}
<div class="body">
<br />
<div class="timer">
<div class="center_children">
<div class="play">Play</div>
</div>
<div class="center_children">1:39</div>
</div>
<br />
</div>
<br /><br />
<div class="body">
<br />
<div class="timer">
<div class="center_children">
<div class="play">
<svg width="100%" height="100%" viewBox="0 0 100 100" ><polygon points="0,0 75,50 0,100" style="fill:#fff;" /></svg>
</div>
</div>
<div class="center_children">1:39</div>
</div>
<br />
</div>