简体   繁体   English

如何删除元素之间不必要的空间?

[英]How to remove an unnecessary space between elements?

Below, the <h3> tag creates a space, and the code gets formatted weirdly. 在下面, <h3>标记创建了一个空格,并且代码被怪异地格式化。 How do you get rid of the space between the 80 and the + sign? 如何摆脱80和+号之间的空间? The counter-up module that I used is from this link: https://www.jqueryscript.net/animation/Animating-Numbers-Counting-Up-with-jQuery-Counter-Up-Plugin.html 我使用的计数器模块来自以下链接: https : //www.jqueryscript.net/animation/Animating-Numbers-Counting-Up-with-jQuery-Counter-Up-Plugin.html

    <section id = "cta" class = "wrapper style3">
        <div class = "row uniform">
            <div class = "4u 6u$(2) 12u$(3)">
                <h2><u>Students</u></h2>
            </div>
            <div class = "4u 6u(2) 12u$(3)">
                <h3 class = "counter">80</h3><h3>+</h3>
            </div>
        </div>
        <script>
            jQuery(document).ready(function( $ ) {
                $('.counter').counterUp({
                    delay: 30,
                    time: 1500
                });
            });
        </script>
    </section>

Headings are block-level elements meaning two adjacent headings will be rendered on two separate lines (as long as you haven't tinkered with their presentation via CSS). 标题是块级元素,这意味着两个相邻的标题将在两条单独的行上呈现(只要您没有通过CSS修改它们的表示方式)。

You can use CSS to append the "+" to the H3 content instead of using another adjacent H3 element: 您可以使用CSS将“ +”附加到H3内容,而不是使用另一个相邻的H3元素:

 h3.counter:after { content: "+"; display: "inline"; } 
 <h2>Without CSS:</h2> <h3>80</h3><h3>+</h3> <h2>With CSS:</h2> <h3 class="counter">80</h3> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM