The tag span is often used when making html web pages, but some friends don’t use this tag well for many friends. They seem to think it is very useful, but it is very troublesome to use, especially when it needs to define its width and height.
A friend once asked: Why does it still have no change in width after defining the height and width of the span with css, and it seems to have failed?In fact, this problem is very simple - first you need to recognize the properties of span, because span is an inline element, and inline elements ignore width and height. If you understand this, it is very simple to solve it. 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. Use the display attribute display directly to define it as a boxed element;
display:block;
2. Use floating attribute float to automatically define it as a boxed element;
float:left;