Defining the minimum height of the inline element span

Defining the minimum height of the inline element span

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;
display:block;

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

<<:  Blog Design Web Design Debut

>>:  How to implement https with nginx and openssl

Recommend

Specific usage of textarea's disabled and readonly attributes

disabled definition and usage The disabled attrib...

HTML Frameset Example Code

This article introduces a framework made by Frame...

WeChat applet implements the snake game

This article shares the specific code of the WeCh...

Several common methods of CSS equal height layout

Equal height layout Refers to the layout of child...

Research on Web Page Size

<br />According to statistics, the average s...

Sample code for making desktop applications with vue + Electron

1.vue packaging Here we use the vue native packag...

How to use shell to perform batch operations on multiple servers

Table of contents SSH protocol SSH Connection pro...

Sample code for seamless scrolling with flex layout

This article mainly introduces the sample code of...

Mysql database recovery actual record by time point

Introduction: MySQL database recovery by time poi...

ftp remotely connect to Linux via SSH

First install ssh in Linux, taking centos as an e...

Markup Language - List

Standardized design solutions - markup languages ...

Axios cancel request and avoid duplicate requests

Table of contents origin status quo Cancel reques...

HTML table markup tutorial (14): table header

<br />In HTML language, you can automaticall...

Two ideas for implementing database horizontal segmentation

introduction With the widespread popularity of In...