Home  >  Article  >  Web Front-end  >  How to define the minimum height of inline element span

How to define the minimum height of inline element span

php中世界最好的语言
php中世界最好的语言Original
2018-02-11 11:15:332255browse

This time I will show you how to define the minimum height of inline element span, what are the precautions for defining the minimum height of inline element span, the following is a practical case, Let’s take a look.

The span tag is often used when making HTML web pages, but some friends are not good at using this tag. Many friends seem to think it is easy to use, but it is very troublesome to use, especially when it needs to be defined. width and height.
A friend once asked: Why after using CSS to define the height and width of a span, its width and height still do not change, as if it has failed?

In fact, this problem is very simple - first understand the attribute of span, because span is an inline element, and inline elements ignore width and height. Once you understand this, it will be solved It's very simple. The solution is to use css to turn span into a boxed element.

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

1. Directly use the display attribute display to define it as a boxed element;

display:block;

2. Use floating attributefloat to automatically define it as a boxed element;

float:left;

I believe you have mastered the method after reading these cases. For more exciting content, please pay attention to other related articles on the php Chinese website!

Related reading:

How to use html area image hotspot

How to use trigger method to achieve input without clicking file type The file selection dialog box pops up

How to set the hide other attributes in the a tag to only display the picture

The above is the detailed content of How to define the minimum height of inline element span. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn