The problem of defining the minimum height of inline element span_HTML/Xhtml_Web page production

WBOY
Release: 2016-05-16 16:39:34
Original
1312 people have browsed it

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;

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template