Solution to define the minimum height of span has no effect

Solution to define the minimum height of span has no effect
The span tag is often used when making HTML web pages, but some friends don’t know how to use this tag well. They think it is easy to use, but troublesome to use, especially when they need to define its width and height.

A friend once asked me: Why after defining the height and width of span with CSS, its width and height still do not change, as if they are invalid?

In fact, this problem is very simple - first you need to 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 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;

Copy code
The code is as follows:

display:block;

2. Use the float attribute to automatically define it as a boxed element;

Copy code
The code is as follows:

float:left;

<<:  Detailed usage of docker-maven-plugin

>>:  Introduction to commonly used fonts on the Web (fonts supported by iOS and Android browsers)

Recommend

MySQL 8.0.19 Installation Tutorial

Download the installation package from the offici...

Docker exposes port 2375, causing server attacks and solutions

I believe that students who have learned about th...

Detailed explanation of MySQL data rows and row overflow mechanism

1. What are the formats of lines? You can see you...

Implementing WeChat tap animation effect based on CSS3 animation attribute

Seeing the recent popular WeChat tap function, I ...

Use scripts to package and upload Docker images with one click

The author has been working on a micro-frontend p...

Deleting two images with the same id in docker

When I created a Docker container today, I accide...

Implementation of FIFO in Linux process communication

FIFO communication (first in first out) FIFO name...

Detailed explanation of how to use $props, $attrs and $listeners in Vue

Table of contents background 1. Document Descript...

Vue implements two-way data binding

This article example shares the specific code of ...

Detailed steps to install MYSQL8.0 on CentOS7.6

1. Generally, mariadb is installed by default in ...

Ubuntu 16.04 kernel upgrade steps

1. Environment Ubuntu 16.04 running on a virtual ...

Detailed steps to modify MySQL stored procedures

Preface In actual development, business requireme...

Basic understanding and use of HTML select option

Detailed explanation of HTML (select option) in ja...

impress.js presentation layer framework (demonstration tool) - first experience

I haven’t blogged for half a year, which I feel a ...