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 the width and height need to be defined for it. time.
A friend once asked: Why after defining the height and width of a span with CSS, 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. The solution is Just use css to turn span into a boxed element.
There are two ways 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 the floating attribute float to automatically define it as a boxed element;
float:left;