Differences between Span and Div in the webpage _ experience exchange

Source: Internet
Author: User
HTML is just a means to give content. Most HTML tags have their meanings (TAG p creates a paragraph, and the h1 tag creates a title, however, the span and div labels do not seem to have any meaning in content, and it sounds as useless as a bubble-made hammer. But they are widely used when combined with CSS. They are used to combine a large piece of HTML code and give certain information. Most of them are associated with elements using class attribute class and id attribute id. For details, see class and id selector in the CSS intermediate guide.

The difference between span and p is that span is inline and used in a small inline HTML, while p (think about what pision means) elements are block-level (simply put, it is equivalent to having a broken line before and after it), used to combine a large piece of code.


This is crazy



In practice, p, especially span, should not be abused, although there are other different opinions. For example, if you want to emphasize the word "crazy" and bold class "paper", such code may be used:


This is Crazy



This is better than adding another span.

Is there any clue about class and id? Don't worry, they will be exposed in the CSS intermediate guide. All you need to remember is that span and p are "meaningless" labels.

The above is the difference between Span and Div in the webpage _ experience exchange content. For more information, see PHP Chinese website (www.php1.cn )!

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.