html - CSS 曲线按钮
问题描述
我需要一个在顶部和底部弯曲的按钮的轮廓,但不是侧面。请参阅下面的示例图片以了解我的要求。我会将我网站上的所有按钮都设置为这样的样式。我已经尝试了几种使用边界半径的方法,但我还没有成功。谢谢你。
解决方案
使用:before
和:after
按钮
.btn {
border-top:none;
border-bottom:none;
border-right: 2px solid white;
border-left: 2px solid white ;
background-color: #273649;
color: white;
padding: 14px 28px;
font-size: 16px;
cursor: pointer;
}
body{
background-color: #273649;
}
.btn:after {
display: block;
content: "";
position: absolute;
width: 89px;
height: 16px;
border-top: white 2px solid;
top: 48px;
left: 7px;
border-radius: 40%;
}
.btn:before {
display: block;
content: "";
position: absolute;
width: 89px;
height: 16px;
border-top: white 2px solid;
top: 4px;
left: 7px;
border-radius: 40%;
}
<button class="btn">Info</button>
推荐阅读
- dialogflow-es - TypeError:无法读取 DialogflowConversation.response 中未定义的属性“simpleResponse”
- ios - 如何使用 SharkORM 读取 BLOB
- macos - 如何在 Macos 上安装和配置 Maven
- javascript - Express REST API 登录直接进入 401 错误
- python - TypeError:尝试运行函数时无法解压不可迭代的 NoneType 对象
- laravel - Laravel 5.5 api 调用使用护照去网络路由而不是 api
- regex - 如果存在特定字符,如何制作所需的部分图案
- javascript - 使用 javascript 的端口敲击在 Linux 上运行良好,但在 Windows 上却不行
- stm32 - STM32F HAL 库太大
- mysql - 在 MySQL Workbench 中转储,未知数据库