gpt4 book ai didi

html - 不使用
只使用语义标签来制作网站真的是最好的吗?

转载 作者:技术小花猫 更新时间:2023-10-29 11:49:21 25 4
gpt4 key购买 nike

我在网上用谷歌搜索找到了这个

并在此处查看文章:http://www.thatcssguy.com/limit-your-divs/

在这里查看他的最终布局:http://www.nodivs.com/

文章中的一些引用

1

When I limited the use of my divs all the major browser including both IE6 and IE7 would render the sites nearly perfectly. Or with very little fixes needed.

2

it’s magic but proves divs nor tables are necessary for layout

我们应该尝试制作这样的网站吗?

最佳答案

这篇文章就如何避免“divitis”提出了很多要点,即在语义上更合适的元素处使用 div 元素。但是这个:

When I limited the use of my divs all the major browser including both IE6 and IE7 would render the sites nearly perfectly. Or with very little fixes needed.

完全是废话。 DIV 是完全有效的容器元素,在很多情况下都有意义。只有在语义上更合适的元素(例如 ul 在像菜单这样的无序列表中,h1 h2 h3 用于标题,ol 用于有序列表)使用 div 是错误的,因为使用 table 进行布局通常是错误的。

你提到的网站的作者所做的是公然滥用其他元素,如 dl(定义列表)作为 div 元素的替代品,这与滥用一样愚蠢divs 作为 ul ol 等的代理。看the W3C's definition of ul, ol, and dl lists并自己考虑这些元素是否应该像作者使用它们那样执行布局任务。

据我所知,暗示不使用 div 以某种方式使站点呈现更好的跨浏览器完全是骗局。如果我错了请纠正我,但我想不出任何一个例子可以证明这一点。

关于html - 不使用 <div> 只使用语义标签来制作网站真的是最好的吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2400823/

25 4 0