Space in HTML code – This article will discuss the space code used in HTML that will not break the code itself. Normally when we use a normal space in HTML it will break the script thus it will not run and generating an error. There are some code for space we can use to avoid this, let’s see how…
Space in HTML – &nbps; is a non-breaking space code usually used in HTML. If you are using space character without code. it will break the code, thus the program cannot read the command correctly.
To create fixed space you also can use code it will also create a non-breaking space that will not break the code by word-wrap. To add the code you must edit in HTML mode, not WYSIWIG mode.
In the internet browser if we ad more than one space it will only left one space. If you want to add more than one space then you have to use %20 code, this is also a non-breaking code.
So if you want 5 spaces you can write %20 %20 %20 %20 %20 the spaces will intact and not break the code.
This is the Special HTML codes including
Char | Numeric code |
Named code |
Description |
---|---|---|---|
	 | horizontal tab | ||
| line feed | ||
| carriage return / enter | ||
  | | non-breaking space |
How To Edit HTML file
HTML code or the file can be edited using notepad. Right click on the html file you want to edit, choose open with (hover the mouse pointer) it will open another menu, choose notepad.
For a better interface I usually using Notepad++, the editor will make the user easier in editing html code or other code as it is visually better than normal notepad.
It has a different color for the code, and the meta tag and other HTML syntax easier to trace and to spot if we have a mistake in our coding. The best part is Notepad ++ is a free software.
Not only HTML Notepad++ is also works best for editing a PHP or asp file or another code file.
Use of in a HTML file
Another form of space in HTML is %20. When the file name “HTML sample file.html” opened in the internet browser, it will replace the space with &20
Non-breaking Space
Space that will not break the code is called non-breaking space. When there is a space breaking in code then the code will not run correctly as it will become 2 codes instead of 1.
The most common implementation of non-breaking code is in the Internet browser. You will never see an URL using space it will replace by %20
What is HTML:
Hyper Text Markup Language or HTML is a standard markup language for web pages. HTML pages are build from elements of HTML that represented by tags <>
What is PHP:
PHP is a recursive acronym for Hypertext Preprocessor. PHP is open-source and a general-purpose of scripting language that can be embedded into HTML.
What PHP can do?
PHP’s main purpose is server-side scripting that can be used to collect form data, send and receive cookies or generate a page with dynamic content and can do more anything you want to.
Sample of PHP script:
<!DOCTYPE html>
<html>
<head>
<title>Example</title>
</head>
<body>
<?php
echo "Hi, this is a PHP script sample!";
?>
</body>
</html>
What is ASP?
ASP is a PHP version from Microsoft.
Active Server Pages (ASP) is a server-side engine script to generate dynamic web pages. Released in Dec 1996, later superseded by ASP.NET in January 2002.
What ASP can do?
ASP can retrieve data on the database by sending a query to the ASP engine, then the server sends the output back to the user, and many more, just like PHP.
ASP script sample
<!DOCTYPE html>
<html>
<body>
<p>ASP can produce plain text:</p>
<%response.write("Hi, sample of ASP script generating plain text!")%>
</body>
</html>
Read also: