Is it possible to use span elements in div elements?

I make a website with personal articles. The body of my articles is the basic paragraphs of a div , but lately it has been useful to me to use some of the span from the paragraphs to control my content as desired, therefore, in the div .

As web semantics is becoming an important role and becoming more and more ingrained, I was curious about the disadvantages of this practice.

I am not familiar with HTML standards yet. However, I thought using span in a div semantically not clean.

Is Google a robot for handling links?

-1
source share
2 answers

There is nothing wrong with using a span element inside a div element. This is absolutely fair. This will not have a negative impact on search engine optimization.

Div elements are block elements, and span elements are inline elements. Inline elements can be placed inside block elements. The opposite is what you want to avoid: don't put div elements inside span elements.

+3
source

Well, if in your case another text-level element does not fit.

You can check their goals in a usage summary : does it represent a hyperlink, underline underline, importance, side comment, ...? If the answer does not match all the candidates, go to "Other", i.e. To the span element.

div and span elements do not represent anything, they are meaningless elements that will be used in cases where another element is not suitable. Therefore, adding / removing div / span elements would never change the semantics of the document (unless significant attributes such as lang ).

0
source

Source: https://habr.com/ru/post/986470/


All Articles