How to write HTML space code? Summary of how HTML space codes behave

Source: Internet
Author: User
Tags php tutorial
This article mainly introduces the code of the HTML space tags, as well as the HTML space for the code presentation summary. Now let's look at this article together.

First, let's talk about our most commonly used space code:

Our usual space code is " " shows a space on the page.

The characters commonly used character entity in HTML is a nonbreaking space ( ).

The browser will always truncate the space in the HTML page. If you write 10 spaces in the text, the browser removes 9 of them before the page is displayed. To increase the number of spaces in the page, you need to use the   character entity.

Use of HTML   space Tags:

&nbsp; can define a half-width space. In other words, the text browser in the <u>...</u> element adds an underscore to the user's browsing.

<!--an HTML space-->&nbsp;<!--two HTML spaces-->&nbsp;&nbsp;<!--multiple HTML space codes to copy multiple &nbsp; -->&nbsp;&nbsp;...&nbsp;

Let's look at a complete code example:


To see the effect in the browser:

Is it obvious that there is a space in the paragraph where there is a space, but the code does not have its own knock hollow lattice.

This is the notation for the space code.

Now let's take a look at the HTML space Code to show how to summarize:

HTML provides 4 types of space entities, which have different widths, non-breaking spaces () are the width of regular spaces and can run on all major browsers. Several other spaces () vary in width across browsers.

1. "&nbsp; "It's called No newline space, the full name no-break space, it is the most common and we use the most space, most people may only touch, it is the space key to produce the spaces." In HTML, if you use the SPACEBAR to generate this space, the space will not accumulate (only 1). To use an HTML entity representation to accumulate,

This space occupies a width that is strongly influenced by the font.

2. "&ensp; It is called "half-width space", the full name is en space,en is the unit of measurement of typography, half of the em width. By definition, it is equal to half the font size (8px in 16px fonts, for example). Nominally the width of the lowercase letter N. This space inherits the character of the space family: transparent, this space has a fairly robust feature,

Is that it occupies a width of exactly 1/2 Chinese width, and is largely unaffected by the font.

3. "&emsp; "It's called" full-width space ", and the name is EM Space,em, which is the unit of measurement of typography, equivalent to the number of points currently specified. 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 fairly robust feature,

Is that it occupies a width of exactly 1 Chinese width, and is largely unaffected by the font.

4. "&thinsp; It is called the narrow space, the full name is thin space. We may call it "thin space", that is, the space is relatively thin, thin body, occupy a relatively small width. It is the one-sixth width of em.

The above is this article about the HTML space Code and the wording of the summary, there are questions can be asked below.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.