CSS行距问题
为什么 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不知道你所说的“跳线”是什么意思。也许实时代码的链接会有所帮助。但我确实注意到您的结束 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.
尝试将 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.