我无法删除字母之间的间距。即使字母间距为0px,它仍然有太多空间

时间:2018-12-12 20:14:12

标签: html css

我想为每个字母设置样式,但是我遇到了一个问题,即我的字母间距不可用,唯一的解决方案是提供负的字母间距,但这又产生了一个问题,即我的悬停效果因- x像素。

<div class="main">        
    <!-- Header -->
    <div class="header" id="home">
        <h1 aria-label=" Hi, I’m Brandon, Developer." style="letter-spacing:0px;">
            <span class="blast" aria-hidden="true" style="opacity: 1;">H</span>
            <span class="blast" aria-hidden="true" style="opacity: 1;">i</span>
            <span class="blast" aria-hidden="true" style="opacity: 1;">,</span>
            <br> <span class="blast" aria-hidden="true" style="opacity: 1;">I</span>
            <span class="blast" aria-hidden="true" style="opacity: 1;">’</span>
            <span class="blast" aria-hidden="true" style="opacity: 1;">m</span>
            <span class="blast" aria-hidden="true" style="opacity: 1;"> </span>
            <span class="blast" aria-hidden="true" style="opacity: 1;">B</span>
            <span class="blast" aria-hidden="true" style="opacity: 1;">r</span>
            <span class="blast" aria-hidden="true" style="opacity: 1;">a</span>
            <span class="blast" aria-hidden="true" style="opacity: 1;">n</span>
            <span class="blast" aria-hidden="true" style="opacity: 1;">d</span>
            <span class="blast" aria-hidden="true" style="opacity: 1;">o</span>
            <span class="blast" aria-hidden="true" style="opacity: 1;">n</span>
            <span class="blast" aria-hidden="true" style="opacity: 1;">,</span>
            <br> <span class="blast" aria-hidden="true" style="opacity: 1;">D</span>
            <span class="blast" aria-hidden="true" style="opacity: 1;">e</span>
            <span class="blast" aria-hidden="true" style="opacity: 1;">v</span>
            <span class="blast" aria-hidden="true" style="opacity: 1;">e</span>
            <span class="blast" aria-hidden="true" style="opacity: 1;">l</span>
            <span class="blast" aria-hidden="true" style="opacity: 1;">o</span>
            <span class="blast" aria-hidden="true" style="opacity: 1;">p</span>
            <span class="blast" aria-hidden="true" style="opacity: 1;">e</span>
            <span class="blast" aria-hidden="true" style="opacity: 1;">r</span>
            <span class="blast" aria-hidden="true" style="opacity: 1;">.</span>
        </h1>
        <h2><strong>Software Developer</strong></h2>
    </div>
    <!-- /Header -->
</div>

Too much spacing

1 个答案:

答案 0 :(得分:2)

通过删除HTML中的span标签之间的所有空白,我看起来很正确。

编辑:很抱歉格式不正确,这是一支代码笔:https://codepen.io/anon/pen/yGYojm

<div class="main">        
    <!-- Header -->
    <div class="header" id="home">
        <h1 aria-label=" Hi, I’m Brandon, Developer." style="letter-spacing:0px;">
            <span class="blast" aria-hidden="true" style="opacity: 1;">H</span><span 
class="blast" aria-hidden="true" style="opacity: 1;">i</span><span class="blast" aria-
hidden="true" style="opacity: 1;">,</span>
           <br> <span class="blast" aria-hidden="true" style="opacity: 1;">I</span>
<span class="blast" aria-hidden="true" style="opacity: 1;">’</span><span class="blast" 
aria-hidden="true" style="opacity: 1;">m</span><span class="blast" aria-hidden="true" 
style="opacity: 1;"> </span><span class="blast" aria-hidden="true" style="opacity: 
1;">B</span><span class="blast" aria-hidden="true" style="opacity: 1;">r</span><span 
class="blast" aria-hidden="true" style="opacity: 1;">a</span><span class="blast" aria-
hidden="true" style="opacity: 1;">n</span><span class="blast" aria-hidden="true" 
style="opacity: 1;">d</span><span class="blast" aria-hidden="true" style="opacity: 
1;">o</span><span class="blast" aria-hidden="true" style="opacity: 1;">n</span><span 
class="blast" aria-hidden="true" style="opacity: 1;">,</span>
        <br> <span class="blast" aria-hidden="true" style="opacity: 1;">D</span><span 
 class="blast" aria-hidden="true" style="opacity: 1;">e</span><span class="blast" aria-
hidden="true" style="opacity: 1;">v</span><span class="blast" aria-hidden="true" 
style="opacity: 1;">e</span><span class="blast" aria-hidden="true" style="opacity: 
1;">l</span><span class="blast" aria-hidden="true" style="opacity: 1;">o</span><span 
class="blast" aria-hidden="true" style="opacity: 1;">p</span><span class="blast" aria-
hidden="true" style="opacity: 1;">e</span><span class="blast" aria-hidden="true" 
style="opacity: 1;">r</span><span class="blast" aria-hidden="true" style="opacity: 
1;">.</span>
    </h1>
    <h2><strong>Software Developer</strong></h2>
</div>
<!-- /Header -->
</div>