在div元素中使用span元素很好吗? [英] Is it fine to use span elements in div elements?

查看:335
本文介绍了在div元素中使用span元素很好吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在制作一个包含个人文章的网站。我的文章的主体是包含段落的基本 div ,但最近我发现使用一些 span 的s根据需要管理我的内容,因此在 div 的s中。



由于网络语义成为一个重要的角色,并越来越受到约束,我很好奇这种做法的缺点。



我还不太熟悉HTML的标准。然而,我认为在 div中使用 span 的div 的语义不太清晰。



Googlebot是否会对此引用产生影响?

解决方案

在div元素中使用span元素。这绝对有效。它不会对搜索引擎优化产生负面影响。div元素是块元素,span元素是内联元素。内联元素可以放置在块元素内部。相反,你想避免:不要把div元素放在span元素中。


I am making a website with personal articles. The body of my articles is a basic div containing paragraphs, but recently I found it useful to use some span's out of the paragraphs to manage my content as desired, hence in the div's.

As the web semantic becomes an important role and becomes more and more well constrained, I was curious of the downsides of such a practice.

I am not too familiar with the standards of HTML yet. However, I was thinking using span's in div's is semantically not clean.

Is the Googlebot going to soil the referencing on that?

解决方案

There is nothing wrong with using a span element inside of a div element. It is absolutely valid. It will have no negative impact on search engine optimization.

div elements are block elements and span elements are inline elements. Inline elements can be placed inside of block elements. The opposite is what you want to avoid: Do not put div elements inside span elements.

这篇关于在div元素中使用span元素很好吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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