gpt4 book ai didi

html - "Táco"比 "Taco"宽。我该如何解决?

转载 作者:搜寻专家 更新时间:2023-10-31 22:40:42 24 4
gpt4 key购买 nike

我正在尝试在没有变音符号的 div 之上加载带有变音符号的 div。虽然间距不像我那样有效。 (请参阅下面的代码片段。)我该如何解决这个问题?

div.text {
width: 75%;
position: relative;
}
div.diacritics {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
z-index: -1;
color: red;
}
<div class="text">String String String String String String String String String String
<div class="diacritics">
Stríng Stríng Stríng Stríng Stríng Stríng Stríng Stríng Stríng Stríng</div>
</div>

<div class="text">Taco Taco Taco Taco Taco Taco Taco Taco Taco Taco
<div class="diacritics">
Táco Táco Táco Táco Táco Táco Táco Táco Táco Táco</div>
</div>

最佳答案

div.text {
width: 75%;
position: relative;
font-family: monospace;
}
div.diacritics {
width: 100%;
height: 100%;
position: absolute;
top: 0;
left: 0;
font-family: monospace;
z-index: -1;
color: red;
}
    <div class="text">String String String String String String String String String String
<div class="diacritics">
Stríng Stríng Stríng Stríng Stríng Stríng Stríng Stríng Stríng Stríng</div>
</div>

<div class="text">Taco Taco Taco Taco Taco Taco Taco Taco Taco Taco
<div class="diacritics">
Táco Táco Táco Táco Táco Táco Táco Táco Táco Táco</div>
</div>

如果您能够做出权衡,您总是可以尝试使用等宽字体系列。

关于html - "Táco"比 "Taco"宽。我该如何解决?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37450633/

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