The meaning of the 5 types of spaces in HTML

The meaning of the 5 types of spaces in HTML

HTML provides five space entities with different widths. Non-breaking spaces ( ) are the width of regular spaces and work in all major browsers. Several other types of spaces ( ‌‍) have different widths in different browsers.

 

It is called No-Break Space. It is the most common and most used space. Most people may have only come into contact with it. It is the space generated by pressing the space key. In HTML, if you use the space bar to create this space, the spaces are not accumulated (only 1 is counted). To accumulate, you need to use HTML entity representation.

The width of the space is obviously and strongly affected by the font.

 

It is called "half-width space", the full name is En Space, en is a unit of measurement in typography, which is half the width of em. By definition, it is equal to half the font size (e.g. 8px in a 16px font). Nominally the width of a lowercase n. This space inherits the characteristics of the space family: transparent, this space has a very stable characteristic,

That is, the width it occupies is exactly 1/2 of the width of Chinese characters, and is basically unaffected by the font.

 

It is called "Em Space", the full name is Em Space, em is a unit of measurement in typography, which is equivalent to the currently specified point size. For example, 1 em is 16px in a 16px font. This space also inherits the characteristics of the space family: transparent, this space also has a very stable characteristic,

That is, the width it occupies is exactly the width of one Chinese character, and is basically not affected by the font.

 

It is called narrow space, the full name is Thin Space. We might as well call it a "thin space", which means that the space is relatively thin and slender, and occupies a relatively small width. It is one-sixth of an em wide.

The above is the meaning of the 5 types of spaces in HTML that I introduced to you. I hope it will be helpful to you. If you have any questions, please leave me a message and I will reply to you in time. I would also like to thank everyone for their support of the 123WORDPRESS.COM website!

<<:  This article tells you how to use event delegation to implement JavaScript message board function

>>:  Detailed explanation of the pitfalls of DTS caused by the timestamp and datetime time zone issues in MySQL

Recommend

Vue implements adding watermark effect to the page

Recently, when I was working on a project, I was ...

How to use Baidu Map API in vue project

Table of contents 1. Register an account on Baidu...

How to display the border when td is empty

Previously, I summarized how to use CSS to achieve...

Detailed explanation of the basic usage of SSH's ssh-keygen command

SSH public key authentication is one of the SSH a...

Solution to MySQL master-slave delay problem

Today we will look at why master-slave delay occu...

What are the image file formats and how to choose

1. Which three formats? They are: gif, jpg, and pn...

MySQL: Data Integrity

Data integrity is divided into: entity integrity,...

CentOS 6-7 yum installation method of PHP (recommended)

1. Check the currently installed PHP packages yum...

Vue realizes the function of uploading photos on PC

This article example shares the specific code of ...

How to implement mobile web page size adaptation

I finally finished the project at hand, and the m...

How to use macros in JavaScript

In languages, macros are often used to implement ...

vue+echarts realizes the flow effect of China map (detailed steps)

@vue+echarts realizes the flow effect of China ma...

Install CentOS system based on WindowsX Hyper-V

At present, most people who use Linux either use ...

Let's deeply understand the event object in js

We know that the commonly used events in JS are: ...