How to define the minimum height of inline element span

php中世界最好的语言
Release: 2018-02-11 11:15:33
Original
2165 people have browsed it

This time I will show you how to define the minimum height ofinline elementspan, what are theprecautionsfor 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 theattribute 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 attributedisplayto define it as a boxed element;

display:block;
Copy after login

2. Usefloating attributefloat to automatically define it as a boxed element;

float:left;
Copy after login

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 use trigger method to achieve input without clicking file type The file selection dialog box pops up

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!

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