跨距元件的替代品是什么? [英] What are alternatives to the span-element?

查看:82
本文介绍了跨距元件的替代品是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

表示您在HTML中没有< p> 元素的工作。你将如何用css来简化一个简单的文本?你会采用什么HTML标签?我总是使用< span> ,但现在我看到span应该总是用于组inline-elements(例如< p& / code>)。

say you are working without the <p> element in HTML. How would you stylize a simple text with css? What HTML-Tag would you take? I always used <span>, but now I saw that span should always be used to group inline-elements (for example <p>). And thats not the case in my example.

谢谢,
phpheini

Thanks, phpheini

推荐答案

首先你应该看看一些标签是否语义匹配。例如,你可能有一个需要强调的文本,在这种情况下, em 是最好的选择。另一种情况是如果你有一个标题,你可以与 h1 ,..., h6 。总是首先考虑这个选项!

First you should look whether some tag matches semantically. For instance, you might have a text which requires emphasis, in which case em is the best choice. Another case is if you have a heading, which you could style with h1, ..., h6. Always first consider this option!

如果你想要风格的文本确实没有意义,或者至少不是css支​​持的意思,你可以使用 span (对于内联文本)或 div (对于块元素)。

If there really is no meaning to the text you want to style, or at least, not a meaning supported by css, you can use either span (for inline text) or div (for block elements).

这篇关于跨距元件的替代品是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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