html - 我想在白色背景 div 中使按钮边框透明
问题描述
我想让按钮边框像附加图像中一样透明。一个带有白色背景颜色的 div,然后在里面我想添加一个具有 15px 边距或填充的按钮,并使其透明。
<div class="row">
<div class="col-md-3 col-12" style="background-color: #fff;">
<p>Thousand of Local Listings.</p>
<div style="padding: 15px;background: transparent;z-index:9999;">
<a href="" style="">START HERE</a>
</div>
</div>
</div>
解决方案
您可以使用box-shadow
透明边框来模拟它:
.box {
border: 1px solid;
overflow: hidden;
width: 300px;
padding: 20px 50px;
}
button {
border: 10px solid transparent;
padding: 10px;
background: #000 padding-box;
color: #fff;
box-shadow: 0 0 0 200vw #fff;
}
.box>*:not(button) {
position: relative;
}
body {
background: gray;
}
<div class="box">
<h2>Title</h2>
<p>some text here and there</p>
<button>A button here</button>
</div>
推荐阅读
- types - 内在类型与原始非内在类型
- javascript - 在 React 中禁用按钮 onClick 但仅对 Index 中的一个元素
- python - 带有证书 SSLv3 的 URLLib 警报握手失败
- flutter - 颤振倒计时
- python - 无法在 Spyder 上导入 kivy
- python - hspan zorder 在 Seaborn 箱线图中没有得到尊重
- c# - WPF:将 DataGrid FallBackValue 设置为今天的日期
- java - IBM Maximo - 发送 HTML 电子邮件
- ios - Apple Health initHeartBeatSeries , 如何获取 HKHeartbeatSeriesSample?
- c++ - 在 C++ 中基于分隔符(即空格)拆分字符串的简单而优雅的方法