The difference between a SPAN element and a DIV element

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.