span in HTML does not display background

Source: Internet
Author: User

If you do not enter any text in span, the background map for the span setting cannot be displayed. The workaround is to set the block element and then set the fixed width height.

Reference: http://blog.csdn.net/jarniyy/article/details/49812787

Further research involves two concepts: inline elements and block elements.

Personal Understanding:

The inline element has no meaning for its width and height, and is displayed based on the size of the content. So you set the background to it and don't enter text, it won't show. Rep: span. Reference: http://www.w3school.com.cn/tags/tag_span.asp

The block element itself is displayed as a row, which can be decorated immediately and is a stand-alone performance, including setting any style on it to change its effect. The typical is Div. Reference: http://www.w3school.com.cn/tags/tag_div.asp

span in HTML does not display background

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.