css - 如何创建圆 Angular 按钮?

标签 css button sass uibutton

我需要像这样创建按钮

enter image description here

您可以在边的中心 看到圆形边框。我试着在课后和课前做这件事,但这很棘手。哪种溶液最干净?我还完成了 dev resizeble 按钮,如果这可以作为一个数字完成,而不需要绝对定位或类似的东西,那就更好了

body {
  background-color: #000;
  display: flex;
  justify-content: center;
  align-items: center;
}

button {
  text-transform: uppercase;
  background-color: #F9EFCA;
  border: none;
  padding: 20px 100px;
  cursor: pointer;
  letter-spacing: 1px;
  border-bottom: 10px solid #ae9e5c !important;
  box-shadow: inset 0 -1px 1px 0 rgba(0, 0, 0, .12), 0 10px 20px -5px rgba(0, 0, 0, .25);
  font-size: 50px;
  transition: .2s all;
  position: relative;
  border-radius: 10px;
}

button:hover,
button:active {
  transition: .2s all;
  border-bottom: none !important;
}

button:before,
button:after {
  content: '';
  position: absolute;
  top: 9%;
  bottom: 0;
  height: 91%;
  background: #F9EFCA;
  width: 10px;
  border-radius: 100%;
}

button:before {
  left: -4px;
}

button:after {
  right: -4px;
}

button:active:before,
button:active:after,
button:hover:before,
button:hover:after {
  top: 9%;
  bottom: 0;
  height: 82%;
}
<button>Call me</button>

Codepen example

最佳答案

创建一个新的按钮类并在你的 CSS 中试试这个:

.button_costum 
{  
  margin: 10px auto;
  font-size: 2.0rem;
  padding: 1.25rem 2.5rem;
  display: block;
  background-color:  // choose what you want
  border: 1px solid transparent;
  color: // choose what you want
  font-weight: 300;
  -webkit-border-radius: 3px;
  border-radius: 20px; // in your case it shout be 25 or 30 
  -webkit-transition: all 0.3s ease-in-out;
  -moz-transition: all 0.3s ease-in-out;
  transition: all 0.3s ease-in-out;
}

关于css - 如何创建圆 Angular 按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51627986/

相关文章:

java - 如果文本字段已填充,则设置启用按钮

css - 为什么以及如何在 sass 中设置多个类?

html - HTML 中的目录树结构

html - 居中按钮文本

CSS 和按钮 : How to override native CSS of html buttons element?

javascript - 如何在css或sass中获取子div的数量

css - 使用 SASS 和 twig 更改菜单的背景颜色以显示事件页面

javascript - 无法将 php 密码字段上传到 phpmyAdmin

html - 嵌套列表下拉菜单 HTML 和 CSS

html - 垂直列表(从水平返回到默认值)