开发者

What HTML tag should be used for semantically meaningless design?

I understand that content should be separated from presentation, but sometimes adding HTML elements for the sake of design is unavoidable. Usually I would use a div, but is th开发者_开发知识库is the best way?

What is the best HTML element to hold semantically meaningless design (no text, images, logos etc...) ?


I would suggest <div>'s for block level elements and <span>'s for inline elements. If you are placing these inside an element that only allows its children to be inline (but you would like the element to be block) use a <span> and use CSS to display it as block. Cringe!
I know this seems obvious (since you pretty much answered your own question), but the purpose of <div>'s and <span>'s are to make up for the lack of a semantically proper element.


You should use <div> (block) or <span> (inline).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜