CSS行距问题

发布于 2024-09-26 13:27:51 字数 961 浏览 4 评论 0原文

为什么 BESTSELLER 这个词会跳过一行...代码中没有任何内容告诉它这样做? (请原谅我 - 这是链接 http://u.neighborrow.com/

      <div class="input text required">
                <label for="ItemItem"></label><input type="text" id="ItemItem" value="" maxlength="255" style="font-size: 25px; width: 200px; margin: 5px 0pt;" name="data[Item][item]">
                <input type="submit" value="Search" style="font-size: 22px" />
            </div>


            <?php echo $form->end(); ?>
            Tips: <span style="font-size: 13px; position: relative; top: -2px"> Taking a trip? Want to try something before you buy it? <br > Have a project or event coming up? Want to see who has a copy of that bestseller?</span>
            <br />
            <?= $form->create('Item', array('action' => 'indextest')); ?>
        </div>

why is the word BESTSELLER skipping a line... there is nothing in the code telling it to do so? (forgive me -- here is the link http://u.neighborrow.com/)

      <div class="input text required">
                <label for="ItemItem"></label><input type="text" id="ItemItem" value="" maxlength="255" style="font-size: 25px; width: 200px; margin: 5px 0pt;" name="data[Item][item]">
                <input type="submit" value="Search" style="font-size: 22px" />
            </div>


            <?php echo $form->end(); ?>
            Tips: <span style="font-size: 13px; position: relative; top: -2px"> Taking a trip? Want to try something before you buy it? <br > Have a project or event coming up? Want to see who has a copy of that bestseller?</span>
            <br />
            <?= $form->create('Item', array('action' => 'indextest')); ?>
        </div>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

永不分离 2024-10-03 13:27:51

我不知道你所说的“跳线”是什么意思。也许实时代码的链接会有所帮助。但我确实注意到您的结束 div 标签比打开标签更多。

编辑:看起来周围的 div 的计算行高为 30px。但主题跨度的行高为 18px。因此,当跨度占据整行时,它会以 18px 行高显示。但是,当它只占用部分行时,30px 行高将应用于该行的其余部分,这会导致最后一行以较大的 30px 行高显示。尝试在父div处设置18px行高,或者将span设置为display:block,这样较大的行高就不会内嵌显示。

I do not know what you mean by "skipping a line". Perhaps a link to the live code would help. But I did notice you have more closing div tags than opening.

EDIT: It appears the surrounding div has a computed line height of 30px. But the subject span has a line height of 18px. So, when the span takes up an entire line, it displays at the 18px line height. But when it only takes up a partial line, the 30px line height is applied to the remainder of that line, and this causes the last line to display at the larger 30px line height. Try setting the 18px line height at the parent div, or set the span to be display: block, so that the larger line height is not displayed in-line.

花开柳相依 2024-10-03 13:27:51

尝试将 display:block 添加到您的跨度或替换任何块级元素的跨度宽度,例如

。在语义世界中,您应该使用

;)

另外,您应该尝试防止内联样式。

Try to add display:block to your span or replace the span width any block-level element such as <p> or <div>. In a semantic world you should use a <p> ;)

Also you should try to prevent inline-styles.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文