如何使用< h2>标签< / h2>在< p>< / p>在文本中间? [英] How to use an <h2> tag </h2> inside a <p></p> in the middle of a text?
问题描述
我想做这样的事情:
I want to do something like this:
<p>This is a <h2>text</h2> paragraph.</p>
我禁用了h2的margin和padding,但仍然在h2 tag之前和之后打破了这一行。如何在文本中间使用h2标签,并使其看起来像是普通单词一样,就像< b>是什么?
I disabled margin and padding for the h2 but it still breaks the line before and after the h2 tag. How can I use the h2 tag in the middle of a text and make it look like if it was a normal word, just like < b > does?
我的html文档的文档类型是XHTML 1.0 Transitional。
The doctype of my html document is "XHTML 1.0 Transitional"
推荐答案
在正文文本中使用意味着标题的标签是不合适的。 < h ..>
标签是逻辑标签;它们的使用赋予了所附文本的含义 - 即文本是一个标题。
It's not appropriate to use a tag that means "heading" within body text. The <h..>
tags are logical tags; their use imparts meaning to the enclosed text -- namely, that the text is a section heading.
尽管您可以使用 display:inline
属性,可以考虑使用更合适的标记,或者甚至是< span>
标记。
Although you could use the display: inline
attribute, consider using a more appropriate tag, or even a <span>
tag.
这篇关于如何使用< h2>标签< / h2>在< p>< / p>在文本中间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!