-4

我尝试将 line-height 更改为 0,这使得间距变得相当小,但每行之间仍有大约 1 cm....
当我在 htmledit(DOT)squarefree(DOT)com/ 中编写 HTML 时看起来很小 http://i.stack.imgur.com/NsBG5.png
但是当我把它放在我的博客上并保存时,间距大大扩大了......
http://i.stack.imgur.com/utZ6m .png

我输入的代码是
<p <span title="Made by [name]" style="background-color:black; border: double 10px #FF0000; text-align: center; font-size: 50px; font-family: arial; color: #FF0000; text-shadow: 5px 5px 4px #8A0808;">Text<br /><span style="text-align: center; font-size: 25px; font-family: arial; color: #8A0808; text-shadow: 0px 0px 0px; line-height: 0;">text<br /><span style="text-align: center; font-size: 25px; font-family: arial; color: #8A0808; text-shadow: 0px 0px; line-height: 0;">text<br /><span style="text-align: center; font-size: 25px; font-family: arial; color: #8A0808; text-shadow: 0px 0px; line-height: 0">text<br /><span style="text-align: center; font-size: 25px; font-family: arial; color: #8A0808; text-shadow: 0px 0px; line-height: 0">text<br /><span style="text-align: center; font-size: 25px; font-family: arial; color: #8A0808; text-shadow: 0px 0px; line-height: 0">text<br /><span style="line-height: 0"><br /><span style="text-align: center; font-size: 15px; font-family: georgia; color: #FF0000; text-shadow: 0px 0px; line-height: 0"> © text</span style="line-height: 0" p>

4

1 回答 1

3

你的代码很乱。大多数标签都没有关闭。

<tag> gets closed with </tag>
<p>some text for a paragraph</p>
<span style="some style">some text to be displayed in that style</span>

(除了自闭合标签,如<input><img>

如果将元素放在其他元素中(称为“嵌套”),则必须正确关闭它们(如上所示),但与打开它们的顺序相反。

<p>this is a paragraph
    <span>this is a span inside the paragraph. it gets closed before the paragraph</span>
   the span is now closed, and the paragraph can be closed
</p>

但是在您的情况下不需要嵌套。请参阅此示例,它可以满足您的需求。这是其中的 HTML:

<div style="background-color:black; border: double 10px #FF0000; text-align: center; font-size: 25px; font-family: arial; color: #FF0000; text-shadow: 5px 5px 4px #8A0808;">
    <!-- Text inside these special braces is called a comment. It isn't displayed on the page -->
    <!-- Beginning of <p> element -->
    <!-- Change the value of "line-height" here to space lines differently -->
    <p style="line-height:25px">
        text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text text
    </p>
    <!-- End of <p> element -->

    <!-- The following "text" is in a separate <p> element, so it will be displayed by itself -->

    <p>
        text
    </p>
</div>
于 2013-07-28T02:57:26.847 回答