gpt4 book ai didi

javascript - 更改::before 伪类中的 'content' 属性

转载 作者:行者123 更新时间:2023-11-28 14:55:36 25 4
gpt4 key购买 nike

<分区>

JSFiddle

在我的 JS 中,我试图访问 dislpay_object::before 类的“内容”属性。我需要将“内容”(文本)设置为页面上 div 的位置。

我已经进行了大量的搜索,但没有在这些类型的伪类上找到如此深入的内容。

  .display_object {
position: absolute;
border: thin solid black;
width: 15cm;
white-space: nowrap;
}

.display_object:active::before {
content: "x,y";
/*needs to be changed to actual values*/
display: block;
position: absolute;
background: rgba(0, 0, 0, 0.48);
padding: 1em 3em;
color: white;
font-size: .8em;
bottom: 1.6em;
left: -1px;
white-space: nowrap;
}

如何通过 JS 引用 :active::before 的 .content,将其设置到当前位置?

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