gpt4 book ai didi

javascript - 伪选择器的重复内容值

转载 作者:太空宇宙 更新时间:2023-11-03 18:32:05 25 4
gpt4 key购买 nike

在网站iA.net他们用伪元素 :before 制作了部分分隔符,以在分隔 rune 本后面创建一条漂亮的虚线。在这种情况下,它是帖子的时间戳和页脚“联系人”标题。

我正在尝试重新创建效果,但我唯一能想出的看起来相似的是:

HTML:

<div class="post-meta post-timestamp">
<div class="post-date">
<time datetime="{{date format="YYYY-MM-DD"}}">{{date format='DD. MMMM YYYY'}}</time>
</div>
</div>

CSS(SASS):

.post-meta {
padding: 2px 0 10px;
color: #b3b3b1;
.post-template & {
border-top: 1px solid #ddd;
margin: 0 0 1.8em;
}
.post-date,
.tag-list {
margin-bottom: 1em;
margin-top: -0.8em;
text-align: center;
}
.post-date time,
.tag-list span {
display: inline-block;
background-color: $body-bg;
padding: 0 1em;
i {
margin-right: 0.24em;
}
}
.home-template & .tag-list span {
display: inline;
}
li {
display: inline;
}
}

我在他们的网站上找到的是以下 HTML/CSS:

<h1 class="section_separator">
<span>19. March 2013</span>
</h1>

CSS:

.section_separator {
font-family: 'iABCRegularSC', Georgia, serif;
text-transform: lowercase;
position: relative;
margin: 0 0 1.52381em 0;
overflow: hidden;
font-size: 1em;
line-height: 1.14286em;
text-align: center; }
.section_separator a,
.section_separator span {
display: inline-block;
position: relative;
padding: 0 10px;
z-index: 1;
background-color: #fdfdfd;
text-decoration: none; }
.section_separator a:hover {
text-decoration: underline; }

.section_separator:before,
.section_separator .before {
font-family: 'iABCRegularSC', Georgia, serif;
text-transform: lowercase;
position: absolute;
top: 0;
left: -1000px;
z-index: -1;
overflow: visible;
text-decoration: none !important;
color: #111111;
font-size: 1em;
line-height: 1.14286em;
letter-spacing: 2px;
content: "µµµµµµµ"; }

我已经研究了一段时间,但找不到如何重新创建它。虽然我很确定他们也为此使用了一种 javascript,因为当我关闭 javascript 时,分隔符不会呈现。但我也无法在使用该分隔符执行任何操作的 javascript 中找到任何内容,或者我可能只是在错误的地方查找。

有人知道他们在这里用的是什么吗?我问是因为我无法弄清楚,我想做类似的事情。

最佳答案

有趣的问题。我可能是错的,但我相当确定这就是正在发生的事情:

µ 符号被插入到页面中,但他们使用自定义字体将此符号显示为一系列约 200 像素宽的点。所以,当他们添加一堆这些符号时,它看起来像一排非常大的点。然后他们只是将那条线滑过一堆,然后让 overflow: hidden; 隐藏每个上多余的点边。

关于javascript - 伪选择器的重复内容值,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19575346/

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