To define the minimum height problem for an inline element span

Source: Internet
Author: User

Span this label, presumably everyone is familiar with it, but it is very difficult to use, especially when you need to define the width and height of the time

Making HTML pages often uses the tag of span, but some friends don't use the tag very well, and seem to think it's good, but it's a hassle to use, especially when it comes to defining width and height.
once a friend asked: Why to use CSS to define the height and width of the span, its width and height has not changed, as if the same failure?

In fact, the problem is simple-to recognize the properties of span, because span is an inline element, and inline elements are ignored width and height, understand this solution is very simple, the solution is to use CSS to make span into a boxed element.

There are two ways to define an inline element as a boxed element:

1. Use Display properties directly to define it as a boxed element;
Display:block;

2. Use float property 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.