The difference between a SPAN element and a DIV element:
This section briefly describes the differences between the span element and the DIV element, because these two elements are very common in the layout, so there are almost no pages that do not apply to these two elements, so here is a brief introduction to the main differences between them.
I. The nature of the element:
The span element is an inline element, and the div element is a block-level element.
The differences between the two types of elements can be found in the section on what is a block-level element and an inline element .
Two. How elements are used:
The div element is primarily used as a large frame layout, while the span element is primarily used to modify the content, such as the color font size.
The code is as follows:
<!DOCTYPE HTML><HTML><Head><MetaCharSet= "Utf-8"><Metaname= "Author"content= "http://www.softwhy.com/" /><title>Ant Tribe</title><styletype= "Text/css">span{Color:Red;Font-weight:Bold;}</style></Head><Body><DivID= "Top">Top of Ant Tribe</Div><Divdir= "Content">Ant Tribe welcomes you, only effort<span>Struggle</span>There will be a better tomorrow.</Div></Body></HTML>
The above code is a simple demonstration, that is, the div is responsible for the large layout, while the span element focuses on the details of the decoration.
The original address is: http://www.softwhy.com/forum.php?mod=viewthread&tid=13064
For more information, refer to: http://www.softwhy.com/divcss/
The difference between a SPAN element and a DIV element