为什么要使用除div之外的任何东西? [英] Why use anything but div?

查看:62
本文介绍了为什么要使用除div之外的任何东西?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在HTML/XHTML中,为什么要使用除div元素之外的其他任何内容?

In HTML/XHTML, why use anything other than div elements?

它们是可以用来构建整个页面的基本块.当然,它们不会增加页面的语义,但是HTML并非与语义有关,而是与结构有关.我为什么还要担心语义?

They are basic blocks that one can use to build entire pages. Sure, they don't add to the semantics of the page, but HTML isn't about semantics, it's about structure. And why should I be concerned about semantics?

有什么想法吗?

编辑:因此,"... HTML与语义无关,而与结构有关".引起了一些大惊小怪;尽管div和span(也许是最常见的元素)违反了该规则,但它被认为完全与语义有关.也许然后,一个更好的问题将是: HTML/XHTML应该与语义有关吗?

So the statement "...HTML isn't about semantics, it's about structure." has caused some fuss; it is argued as being all about semantics, although div and span (perhaps the most common elements) break this rule. Perhaps then, a better question would be to ask: should HTML/XHTML be about semantics?

推荐答案

并非所有元素都应该是块级元素,并且需要为页面上的每个div指定div属于哪种元素是荒谬的.它也更容易阅读.

Not all elements should be block level elements and the need to specify what kind of element a div is for every div on your page is ridiculous. It is also easier to read.

这篇关于为什么要使用除div之外的任何东西?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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