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 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!