We should be familiar with the span tag, but it is very troublesome to use it, especially when we need to define the width and height for it, html pages often use the span tag, however, some friends may not use this label well. They seem to find it useful, but it is very troublesome to use it, especially when you need to define its width and height.
A friend once asked:Why does the width and height of span remain unchanged after css is used to define the height and width of span?
In fact, this problem is very simple-first recognize the span attribute, because span is an inline element, while the inline element ignores the width and height. It is very easy to understand this solution, the solution is to use css to change span to a boxed element.
There are two methods 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 float to automatically define it as a boxed element;
Float: left;