除标题等之外的 HTML 元素
我正在浏览我的问题的相关问题,但似乎找不到答案。无论如何,我想知道当我已经在我的网站上将两者(p 和 div 标签)用作纯文本时,我是否仍然可以使用 p 或 div 标签而不是标题标签。原因是我只想在我的网站中出现一个标头标签 h1。我试图调整一些部分,但一路上迷失了方向。遗憾的是,经过几次测试后,它不起作用...我想知道这是否可能,或者除了 header 标签之外是否还有其他 HTML 标签可以使用。非常感谢你们的任何回复。 =)
I was browsing related issues for my question but I can't seem to find the answer for it. Anyways, I want to know if I can still use the p or div tags instead of header tags when I have already used both (p and div tags) as plain text on my site. The reason is that I only want to have one header tag h1 present in my site. I tried to tweak some parts and got lost along the way. Sadly, after a couple of testing, it did not work... I was wondering if it's possible or if there's any other HTML tag that I can use other than header tag. Any response from you guys will be very much appreciated. =)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
等之外的 HTML 元素
我正在浏览我的问题的相关问题,但似乎找不到答案。无论如何,我想知道当我已经在我的网站上将两者(p 和 div 标签)用作纯文本时,我是否仍然可以使用 p 或 div 标签而不是标题标签。原因是我只想在我的网站中出现一个标头标签 h1。我试图调整一些部分,但一路上迷失了方向。遗憾的是,经过几次测试后,它不起作用...我想知道这是否可能,或者除了 header 标签之外是否还有其他 HTML 标签可以使用。非常感谢你们的任何回复。 =)
I was browsing related issues for my question but I can't seem to find the answer for it. Anyways, I want to know if I can still use the p or div tags instead of header tags when I have already used both (p and div tags) as plain text on my site. The reason is that I only want to have one header tag h1 present in my site. I tried to tweak some parts and got lost along the way. Sadly, after a couple of testing, it did not work... I was wondering if it's possible or if there's any other HTML tag that I can use other than header tag. Any response from you guys will be very much appreciated. =)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
您可以反复使用
P
和DIV
标记。如果需要,请将它们设置为类似于H1
的样式。--
You can use
P
andDIV
tags over and over. If you need to, style them to look likeH1
's.--
不要忘记记住您网站上的搜索引擎优化。想必这就是为什么你只想要一个 H1 标签的原因?
Don't forget to remember SEO on your site. Presumably this is why you only want one H1 tag?
和
是您可以在
标签。
<span>
<strong>
and<em>
are others you can use inside your<p>
tags.我会使用
或
标签并使用 ids 或类来控制样式。如果只有一次实例或类,并且您想重复此样式,请使用 ids。您还可以在一个元素上使用多个类,
例如
使用 css
希望这会有所帮助
i would use
<div>
or<span>
tags and use ids or classes to control the style. use ids if there is only once instance or classes if you want to repeat this style. you can also use multiple classes on one elementfor example
with css
hope this helps
您可以使用多个 h1 或 h2,然后像这样定位它们:
这并不完全是您所要求的。我怀疑谷歌比单一的 H1 方法更聪明。
You can use multiple h1's or h2's and just target them like this:
It's not quite what you're asking. I suspect Google is a bit smarter than single H1 approaches.
您可以将
设为您喜欢的外观,例如:
使用
,但我建议反对它。原因是 HTML(表面上)是语义的,因此如果您声明:
您实际上是在(语义上)说给定的文本是某种标题。请记住,您有
到
,您可以选择使用其中的哪一个。不需要使用
来使用
等等。
这对于视觉障碍者也很有用,因为对于那些使用屏幕阅读器的人来说,标题样式的内容不会被指示,但标题会被指示。您应该尽可能解决可访问性问题。
You can make a
<p>
look however you like, for example:with
but I would recommend against it. The reason is that HTML is (ostensibly) semantic so if you declare:
you're actually saying (semantically) that the given text is a heading of some sort. Remember you have
<h1>
through<h6>
and you can pick and choose which of them you use. There is no need to use<h1>
to use<h2>
and so on.This is also useful for those visually impaired as something styled as a heading won't be indicated as such to those using screen readers but a heading will be. You should cater for accessibility issues where possible.
您不应该将 div、span 或 p 设置为看起来像标题,然后将其用于 h1-h6 之外的位置。这完全违背了经验法则背后的精神,即一页上不应该有多个 h1。
You should not style a div, span, or p to look like a heading and then use it in place off an h1-h6. That is exactly contrary to the spirit behind the rule of thumb that you shouldn't have more than one h1 on a page.
也是一个有用的补充。
<span>
is a useful addition, as well.