Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

How to type spaces in HTML


May 03, 2021 HTML


Table of contents


How to type spaces in HTML

  • Type a space

    In the html web page a space, we can type the "space" key to achieve.

  • Multiple html space characters

    If you want to achieve multiple space gaps in html, if you type more than one Space key, you end up showing only one space gap. T his is when we need real space character   It's gone.


Code example:

Programming W3cschool & NBSP; Learn to Program W3cschool & NBSP; & NBSP; Learning to Program W3cschool & NBSP;
  

Try it out . . .


How to type spaces in HTML


Multiple escape characters for HTML spaces

  • Normal English half-corner spaces
  • No-break space (normal English half-corner space but no line break)
  • The Chinese full-width space (one Chinese width)
  • en space (half Chinese width)
  • em space (one Chinese width)
  • - Quarter em space (quarter Chinese width)

nbsp has an uninterrupted (non-breaking) feature compared to the usual space ( ). T hat is, continuous nbsp is displayed on the same line. Even with 100 consecutive nbsp, browsers don't split them into two rows.

How to dynamically add spaces to HTML with JS

Front-end projects sometimes need to dynamically add spaces with JS, for example to take care of the style of CSS or to take care of the implementation of special effects. J ust use this method.
Html:

If you don't just want to null between div, but you want to add spaces dynamically, so (jquery)

$("#id").innerHTML += " ";

Use HTML (hyper-text markup language) to add paragraph spacing
If you want the text you enter to form a paragraph, insert a paragraph before the paragraph, and insert a paragraph between the sentence and the sentence to split the sentence.

Introduction to W3CSChool

W3cschool.cn is registered and built in August 2009, it is one of the technical online tutorial sites earlier than the W3C standard for tutorial materials. Later, after years of business, it became a well-known W3CSChool Online Tutorial website, 2016Start company operation.


The website mainly provides beginners to provide entry-based learning content and daily technical data query services.


In order to better serve everyone, a large number of online instances are provided in this site. Through example, you can better learn how to build it.


And we will update the content in real time according to the current change of the Internet.


For our website and content, if there is a lack of insufficient, the majority of technical enthusiasts are welcome to give comments and suggestions.




Try it out . . .