Define the minimum height of the inline element span _ HTML/Xhtml _ webpage Creation

Source: Internet
Author: User
We should be familiar with the span tag, but it is very troublesome to use it, especially when we need to define the width and height for it, html pages often use the span tag, however, some friends may not use this label well. They seem to find it useful, but it is very troublesome to use it, especially when you need to define its width and height.
A friend once asked:Why does the width and height of span remain unchanged after css is used to define the height and width of span?

In fact, this problem is very simple-first recognize the span attribute, because span is an inline element, while the inline element ignores the width and height. It is very easy to understand this solution, the solution is to use css to change span to a boxed element.

There are two methods to define inline elements as boxed elements:

1. directly use the display attribute display to define it as a boxed element;
Display: block;

2. Use float to automatically define it as a boxed element;
Float: left;

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.