html - 如何在CSS中删除透明按钮后面的线
问题描述
如何在 CSS 中删除透明按钮后面的线?见下图如何在CSS中删除透明按钮后面的线?见下图如何在CSS中删除透明按钮后面的线?见下图
.fullscreen {
height: 100%;
width: 100%;
background: no-repeat url("https://www.planetware.com/wpimages/2019/10/switzerland-in-pictures-most-beautiful-places-matterhorn.jpg") center / cover;
}
.line {
position: absolute;
width: 3px;
height: 100%;
background-color: rgba(255, 255, 255, 1);
top: 0;
left: 50%;
}
.btn {
position: absolute;
width: 100px;
height: 100px;
border: 3px solid #ffffff;
transform: translate(-50%, -50%);
top: 50%;
left: 50%;
z-index: 1;
}
.btn::after {
content: '';
display: block;
width: 60px;
height: 60px;
background: #ffffff;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
<div class="fullscreen">
<span class="line"></span>
<div class="btn"></div>
</div>
解决方案
这更像是一种 hack,可能对您不起作用,因为到目前为止您还没有提供任何代码。
我的想法是给(在我的情况下).outer_box
与 the 相同background-image
的.background
值并以相同的方式对其进行缩放。
.fullscreen {
height: 100vh;
width: 100vw;
background: no-repeat url("https://www.planetware.com/wpimages/2019/10/switzerland-in-pictures-most-beautiful-places-matterhorn.jpg") center / cover;
}
.line {
position: absolute;
width: 3px;
height: 100%;
background-color: rgba(255, 255, 255, 1);
top: 0;
left: 50%;
}
.btn {
position: absolute;
width: 100px;
height: 100px;
border: 3px solid #ffffff;
transform: translate(-50%, -50%);
top: 50%;
left: 50%;
z-index: 1;
background: no-repeat url("https://www.planetware.com/wpimages/2019/10/switzerland-in-pictures-most-beautiful-places-matterhorn.jpg") center / cover;
background-size: 100vw;
}
.btn::after {
content: '';
display: block;
width: 60px;
height: 60px;
background: #ffffff;
position: absolute;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
}
<div class="fullscreen">
<span class="line"></span>
<div class="btn"></div>
</div>
推荐阅读
- laravel - Laravel - 无需登录即可禁用 cookie
- c# - 如何刷新视图中的单个元素?
- r - 如何将data1变成data2?
- java - 为什么在片段中暂停媒体播放器时应用程序崩溃
- sql - 如何修改数据库中的值(所有表所有列)
- javascript - 如何让 Ant 设计子菜单在 React 功能组件中保持打开状态
- xamarin.forms - 使用某些接口时依赖服务不起作用
- android - 在Android编程中执行定时器中的函数时停止程序
- node.js - 如何使用来自 env 的端口值将 React 应用程序部署到 Heroku?
- ios - 如何识别 EKCalendar 以存储用户日历选择