如何在div中绘制一个正方形

问题描述 投票:0回答:1

我有一个图像,我想在其中制作一个正方形,但它绘制一个矩形。

p::after { 
  content: "";
  background-color: red;
  padding: 5px;
  /*line-height: 0px;*/
}
<p>That is not a square -&gt;</p>
css
1个回答
1
投票

display:inline-block将解决问题

p::after { 
  content: "";
  display:inline-block;
  background-color: red;
  padding: 5px;
  /*line-height: 0px;*/
}
<p>That is a square -&gt;</p>
最新问题
© www.soinside.com 2019 - 2024. All rights reserved.