【问题标题】:How to hide border from Input Button, Bootstrap conflict如何从输入按钮隐藏边框,引导冲突
【发布时间】:2016-11-24 18:50:33
【问题描述】:

我尝试制作一个 fab 类似 Material Design 的 fab 按钮。

我使用border-radius 将其设为圆形,但之后当我点击它时,它会选择为正方形,如下所示:

.fab {
  border-radius: 50%;
  border: 0;
  color: #000;
  margin: auto;
  padding: auto;
  vertical-align: middle;
  box-shadow: 0 2px 7px rgba(0, 0, 0, .5);
  position: fixed !important;
  right: 20px;
  bottom: 20px;
  z-index: 100;
  -webkit-user-select: none;
}

.fab.big {
  width: 50px;
  height: 50px;
}
<button class="fab big white ripple red-ripple">
  <i style="font-size:18px;"
     class="material-icons">
    add
  </i>
</button>

我想要一个 fab 按钮是这样的:Material Design Lite Buttons

我也试过-webkit-user-select: none,但没用。

普通按钮也会发生同样的事情,我该如何解决这个问题?

【问题讨论】:

  • 研究 CSS 形状。除此之外,HTML 中的任何元素都将始终是一个矩形。
  • 是的,我知道,但我想隐藏选定的边框
  • 哦,谢谢,它帮助了我。 :)

标签: html css button


【解决方案1】:

如 cmets 中所述,outline: none; 可用于防止在单击时显示方形边框。

.fab{
border-radius:50%; 
border:0; 
color:#000; 
margin: auto; 
padding:auto; 
vertical-align: middle; 
box-shadow:0px 2px 7px rgba(0,0,0,0.5); 
position:fixed !important; 
right:20px; 
bottom:20px;
z-index:100;
-webkit-user-select:none;
  outline: none;
}

.fab.big{
width:50px; 
height:50px; 
}
&lt;button class="fab big white ripple red-ripple"&gt;&lt;i style="font-size:18px;" class="material-icons"&gt;add&lt;/i&gt;&lt;/button&gt;

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2022-01-13
    • 2013-11-22
    • 1970-01-01
    • 1970-01-01
    • 2011-09-20
    • 2014-01-30
    相关资源
    最近更新 更多