如何使用< h2>标签< / h2>在< p>< / p>在文本中间? [英] How to use an <h2> tag </h2> inside a <p></p> in the middle of a text?

查看:199
本文介绍了如何使用< h2>标签< / h2>在< p>< / p>在文本中间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想做这样的事情:

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.

这篇关于如何使用&lt; h2&gt;标签&lt; / h2&gt;在&lt; p&gt;&lt; / p&gt;在文本中间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆