gpt4 book ai didi

pseudo-element - CSS 虚线阴影

转载 作者:行者123 更新时间:2023-11-28 09:48:13 27 4
gpt4 key购买 nike

假设我有一个带有下划线的跨度:

<span class="underline">Hello, I'm underlined text</span>

.underline {
color: #444;
font-size: 250%;
display:inline-block;
border-bottom: 1px dashed #444;
}

我需要下划线的底部阴影。我假设 box-shadow 不是这种情况,唯一可能的解决方案是通过伪元素来实现。我这样做:

.underline:after {
content:"";
border-bottom: 1px dashed #ff0000;
display: block;
}

这会在下划线上方显示红色虚线,但我需要在下划线下方显示。这怎么可能?

提前致谢。

最佳答案

像这样使用position: relative;:

.underline:after {
content:"";
border-bottom: 1px dashed #ff0000;
display: block;
position: relative;
top: 2px;
}

关于pseudo-element - CSS 虚线阴影,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25561366/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com