css - CSS - 通过(下方)SVG 徽标图像添加细水平线
问题描述
如何实现这样的水平线穿过(在它下面有情人z-index,所以它实际上通过图像不可见)SVG标志图像,但它不会接触侧面的图像,正如我们在这里看到的那样,线之间有间隙和图像的每一侧。已经尝试将图像容器设置为相对并在其上添加 ::before 伪类,将此细线设置为:
&:before {
content: '';
position: absolute;
top: 50%;
left: 0;
border-top: 1px solid $whiteColor;
width: 100%;
transform: translateY(-50%);
}
但它通过 SVG 徽标并通过它可见。我想实现这一点:
解决方案
尝试使用 &:before 和 &:after 伪类来实现这一点。例如,您可以使用:
&:before {
content: '';
position: absolute;
top: 50%;
left: 0;
border-top: 1px solid $whiteColor;
width: 40%;
transform: translateY(-50%);
}
&:after {
content: '';
position: absolute;
top: 50%;
right: 0;
border-top: 1px solid $whiteColor;
width: 40%;
transform: translateY(-50%);
}
不确定这是否可行,只是复制了您的示例并想向您展示逻辑:)
推荐阅读
- java - 在Android Studio中添加依赖项后重复类
- javascript - 一张一张显示数据 JavaScript
- php - 渲染错误:TypeError:无法读取 laravel vuejs 中未定义的属性标题
- linux - Eroor:您需要安装 gtk-doc >= 1.12 才能构建 GStreamer RTSP 服务器(Gstreamer RTSP 服务器交叉编译)
- reactjs - 链接中的状态未设置,返回未定义
- python - 使用存储在 python 中的多个矩阵中的数据创建和求解线性方程组的不同组合
- javascript - 单击任何一个 div 时隐藏其他 div
- r - 如何将数据写入具有不同索引的单个列?
- windows - Windows 10 和 2012 中的 Windows IOCP 套接字编程崩溃
- google-chrome - 有没有办法在没有 Selenium 的情况下打开新版本的 Chrome