[英]How to create circle/square shapes using React with text inside them without using SVG images?
您甚至可以使用div
标签来做到这一点。 只需添加border-radius
即可创建一个圆。
反应示例: https : //codesandbox.io/s/shapes-qbf1f
这是一个快速概述的片段:
.square { display: flex; width: 100px; height: 100px; background-color: red; } .circle { display: flex; width: 100px; height: 100px; background-color: green; border-radius: 50%; } .text { margin: auto; }
<div class="square"> <p class="text">Square text</p> </div> <div class="circle"> <p class="text">Circle text</p> </div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.