0
4

2 回答 2

2

The problem shouldn't be that you have too many HTML elements that are divs, but the problem arises if you have too many HTML elements tout court.

"Some dude" in your story is, then, wrong in my opinion. In some cases - and possibly for some SEO benefits - some HTML elements are preferred over others, but you can't just look at a HTML page and say "Well, I see so many div tags, why not change this to that and that to this and it looks prettier!"

The thing I would look at is: how can I make my HTML structure more semantically logical. This would probably involve all te new HTML5 elements. The use of section, article, aside, nav and role attributes make a page much more intuitive and logical. Basically, with HTML5 you can show a person that knows nothing of webcoding the code of your HTML5 page and by simply looking at the tags you used, he can easily derive what is important and what not. That's the beauty of HTML5.

So, before randomly starting to change some div tags to strong tags, consider HTML5. And you might also want to ask WHY "some dude" wants you to change it. Maybe he does have a legitmate reason, you never know!

于 2013-11-12T19:57:24.620 回答
1

Strong 和 Em 是内联标签,应该使用粗体或将斜体添加到单词本身。基本上就是这样。它们不应该是块元素。不是他们的真正目的。

那个说你有太多 div 并建议使用 strong 或 em 作为块元素来缓解这个问题的人在他们的方法中是非常不合时宜的。

我建议,至少提供一些不同的东西,使用 HTML5 元素标签,如文章、部分、页眉、页脚等,以使代码更具可读性。假设这就是你要找的。

如果您需要支持无法识别新标签的旧浏览器。看看像 Modernizr.js 这样的东西。

于 2013-11-12T20:01:35.203 回答