Home >Web Front-end >HTML Tutorial >Defining the minimum height of span has no effect.
Some friends say that the span tag is not easy to use, especially when you need to define the width and height for it. There are two good solutions below. You may wish to refer to them.
The span tag is often used when making HTML web pages, but some friends have trouble using this tag. Many friends seem to think it is easy to use, but it is very troublesome to use, especially when it is necessary to define the 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 - you must first understand the properties of span, because span is an inline element, and inline elements ignore width and height. Once you understand this, the solution is very simple. Solve The best way 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;
The code is as follows:
display:block;
2. Use the floating attribute float to automatically define it as a boxed element;
The code is as follows:
float:left;
For more related articles on how to solve the problem of defining the minimum height of span without effect, please pay attention to the PHP Chinese website!