html - 字体大小迫使圆形按钮变宽

标签 html css ionic-framework ionic3

我这里遇到了一些问题。

我正在使用 Ionic 3。

我有一个带有加号的圆形按钮。当我增加加号 font-size 时,它会强制按钮变宽 as you can see here 。我尝试过设置 max-width!important 以及许多其他内容,但它们没有做任何事情。 Here is what it looks like unscaled

.btnAddImage {
  background: rgba(255, 255, 255, 0.3);
  width: 150px;
  height: 150px;
  color: #4E4E4E;
  font-size: 100px;
  border-radius: 50%;
}
<div text-center>
  <button ion-button class="btnAddImage">+</button>
</div>

我的目标是有一个带有大加号的圆形按钮。

干杯,祖克

最佳答案

这有效,只需更改名称:

.circle {
  border-radius: 50%;
  width: 150px;
  height: 150px;
  background: rgba(255, 255, 255, 0.3);
  position: relative;
  border: 1px solid black;
}

.circle::after {
  content: " ";
  position: absolute;
  display: block;
  background-color: black;
  height: 5px;
  margin-top: -5px;
  top: 50%;
  left: 10px;
  right: 10px;
  z-index: 9;
}

.circle::before {
  content: " ";
  position: absolute;
  display: block;
  background-color: black;
  width: 5px;
  margin-left: -5px;
  left: 50%;
  top: 10px;
  bottom: 10px;
  z-index: 9;
}
<div class="circle"></div>

关于html - 字体大小迫使圆形按钮变宽,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50700549/

相关文章:

javascript - 当我点击一个 div 时停止一个函数

javascript - 在 iPad 上,html 5 视频标签的 src 属性中的 http url 不起作用

html - CSS 将类型选择器应用于另一个元素

php - ionic + Ubuntu : connect to mysql/phpmyadmin

angular - 如何在不丢失准备好的 css 的情况下在 Ionic 2/3 中编写自定义组件?

javascript - 在 PaperJS 中平移大 svg 的问题

jquery - 在悬停时保持元素打开

html - 在 Ionic 5 中更改 ion-searchbar 输入的字体大小

php - jReject 在 IE7 中不起作用

javascript - onclick 获取元素 id 结果 undefined jquery