How to display & in html


html - What's the correct way to display multi line text?

Asked

Modified 7 months ago

Viewed 42k times

I have a HTML document with some distinct rows of text, is there some decided correct way to display them?

Example:

Here are some lines of text 

Should I use the <p> tag for each row, or is there some other/better way to do it?

Examples:

<p>Here are</p> <p>some lines</p> <p>of text</p> 

or

<p> Here are <br> some lines <br> of text <br> </p> 

Or something completely different?

The CSS & other things isn't really relevant at the moment, I'm just wondering which is the "most correct" way to use.

2

if you have a string with new lines that you want to display for example in a div, you can use white-space: pre-wrap css style:

. multiline { white-space: pre-wrap; } <div> A multiline text for demo purpose </div> 

1

Or you can try this without tag wrapping each line:

<div> Here are some lines of text </div> 

1

The correct way to do things is using things made for the things you need. If you want a line break (enter), use <br>; If you want to define a paragraph, use <p>.

According to this, the <br> element is used to insert a line break without starting a new paragraph. Hence you should prefer the second solution over the first.

w3schools comes with a marvelous article about style guides and coding conventions.

0

The spec makes it very clear that <br> should never be used unless the line breaks are actually part of the content forming a single unit of text.

As these are distinct rows of text, not a single unit that happens to contain line breaks, they need to be split into separate <p> elements.

There is no such thing in most correct way, at least according to the current specification of your needs. Yes, you can put them all in separate paragraphs, using the <p></p> tag or you can separate them via a <br> tag at every line. You can also use spans combined with the white-space CSS attribute, so you have a lot of options. To choose the best option for you, you will need to try them out and see what fits your requirements the best.

If you want to create a multiline paragraph that maintains the line seperation in your code without throwing
s everywhere. Simply use the html tag.

1

Your Answer

Sign up or log in

Sign up using Google

Sign up using Facebook

Sign up using Email and Password

Post as a guest

Email

Required, but never shown

Post as a guest

Email

Required, but never shown

HTML Entities

❮ Previous Next ❯


Reserved characters in HTML must be replaced with character entities.


HTML Entities

Some characters are reserved in HTML.

If you use the less than (<) or greater than (>) signs in your text, the browser might mix them with tags.

Character entities are used to display reserved characters in HTML.

A character entity looks like this:

&entity_name;

OR

&#entity_number;

To display a less than sign (<) we must write: &lt; or &#60;

Advantage of using an entity name: An entity name is easy to remember.
Disadvantage of using an entity name: Browsers may not support all entity names, but the support for entity numbers is good.


Non-breaking Space

A commonly used entity in HTML is the non-breaking space: &nbsp;

A non-breaking space is a space that will not break into a new line.

Two words separated by a non-breaking space will stick together (not break into a new line). This is handy when breaking the words might be disruptive.

Examples:

Another common use of the non-breaking space is to prevent browsers from truncating spaces in HTML pages.

If you write 10 spaces in your text, the browser will remove 9 of them. To add real spaces to your text, you can use the &nbsp; character entity.

Tip: The non-breaking hyphen (&#8209;) is used to define a hyphen character (‑) that does not break into a new line.



Some Useful HTML Character Entities

Result Description Entity Name Entity Number Try it
non-breaking space &nbsp; &#160; Try it »
< less than &lt; &#60; Try it »
> greater than &gt; &#62; Try it »
& ampersand &amp; &#38; Try it »
" double quotation mark &quot; &#34; Try it »
' single quotation mark (apostrophe) &apos; &#39; Try it »
¢ cent &cent; &#162; Try it »
£ pound &pound; &#163; Try it »
¥ yen &yen; &#165; Try it »
euro &euro; &#8364; Try it »
© copyright &copy; &#169; Try it »
® registered trademark &reg; &#174; Try it »

Note: Entity names are case sensitive.


Combining Diacritical Marks

A diacritical mark is a "glyph" added to a letter.

Some diacritical marks, like grave (  ̀) and acute (  ́) are called accents.

Diacritical marks can appear both above and below a letter, inside a letter, and between two letters.

Diacritical marks can be used in combination with alphanumeric characters to produce a character that is not present in the character set (encoding) used in the page.

Here are some examples:

Mark Character Construct Result Try it
 ̀ a a&#768; Try it »
 ́ a a&#769; Try it »
̂ a a&#770; Try it »
 ̃ a a&#771; Try it »
 ̀ O O&#768; Try it »
 ́ O O&#769; Try it »
̂ O O&#770; Try it »
 ̃ O O&#771; Try it »

You will see more HTML symbols in the next chapter of this tutorial.

❮ Previous Next ❯


NEW

We just launched
W3Schools videos

Explore now

COLOR PICKER
CODE GAME

Play Game




Top Tutorials
HTML Tutorial
CSS Tutorial
JavaScript Tutorial
How To Tutorial
SQL Tutorial
Python Tutorial
W3.CSS Tutorial
Bootstrap Tutorial
PHP Tutorial
Java Tutorial
C++ Tutorial
jQuery Tutorial

Top References
HTML Reference
CSS Reference
JavaScript Reference
SQL Reference
Python Reference
W3.CSS Reference
Bootstrap Reference
PHP Reference
HTML Colors
Java Reference
Angular Reference
jQuery Reference

Top Examples
HTML Examples
CSS Examples
JavaScript Examples
How To Examples
SQL Examples
Python Examples
W3.CSS Examples
Bootstrap Examples
PHP Examples
Java Examples
XML Examples
jQuery Examples


FORUM | ABOUT

W3Schools is optimized for learning and training. Examples might be simplified to improve reading and learning. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. While using W3Schools, you agree to have read and accepted our terms of use, cookie and privacy policy.

Copyright 1999-2022 by Refsnes Data. All Rights Reserved.
W3Schools is Powered by W3.CSS.

How to display HTML code in HTML page

Tags: Web Page Front End Foundation html css

How to display HTML code in HTML page
Display HTML code in HTML page
Method 1: Preless Plus Code tab (personal favorite style)

Use

 tag, . 
Note: All "<", ">" in the code is replaced by yet and && gt, if not replaced, does not recognize the HTML language, resulting in executing this code instead of displaying the code. If there are other special characters in the code, there is also a replacement. If you don't pre-add, all code completions will be considered a space that will wrap according to the size of the browser, and will not go from the side of the wrap.

 
Here is the code

Results as below:

Method 2: Textarea tag (may be used if the code is too long)
  

Results as below:

Method 3: XMP Tag (didn't try it)

Note: I've seen the XMP tag online, but HTML5 doesn't support this tag in the HTML Manual.

Display the result of the HTML code in an HTML 9 page0005

Copy the code directly.

 Here is the code 

Smart recommendation

A few questions about reference signs 2018-06-15

The default pointer under an arc is a strong reference: __ SICK & __ weak and __ unsafe comparison reference: __strong & __weak & __ Unsafe_unreted...

Pytorch uses more GPU facilities

Using multiple GPUs in Pytorch requires the declared model to be initialized after the Declarative Model, such as: Then, after running the Python file The Model Training, all GPUs. ..

How long is it so long? How did logistics robots not run into thousands of households?

In the CEC Prisoners Group "The German Continental Group demonstrates its latest logistics robots" - the Anymal package delivery dog. For this, the result of the Circle of Media and Technology...

Notes on the practical study of machine learning --- a priori algorithm

Association analysis is the task of finding interesting relationships in large-scale datasets. These relationships can take two forms: Frequent Item Sets: A set of items that appear frequently...

Spring(4) Third Integration Final Chapter Framework

Spring_day04 (integration of three main frameworks) 1. Three frameworks (integration principle) The backend of a web project is divided into three layers. 2. Guide package (42) hibernate: hibernate/lib/required hiberna...

You may also like

First understanding of the Python series unit test

The unittest framework can be used not only for unit testing, but also for developing and executing web-based automated test cases. A test framework can ...

The principle of inconsistent loading of images in the process of loading images as a list.

// Main interface layout // Nested layout // Main function MainActivity // Create a new bean class // Create an adapter // Tools...

SpringBoot + mysql + docker project deployment

Preparing the domain name and Alibaba Cloud server domain name: You can purchase the required domain names from major cloud service providers. I purchased an Alibaba Cloud domain name. To the cloud...

Build an IPA server from scratch. Implementation of LDAP + Kerberos Domain Verification (Open Firewall, Command Version)

Figure configuration method, please refer to Article 1, experimental environment: Physics host host two virtual machines. Host Physical IP: 192.168.9.6/24 GW: 192.168.9.254 DNS: 8.8.8.8 Virtual...

Invoking the Apollo Configuration Center Client

Apollo Config Center client call introduction Config Center Create project Publish namespace Create local cache configuration file springboot project code Previous post: . ..

Getting Started with HTML - Learn Web Development

In this article, we'll cover the HTML basics you need to get started. Let's define "elements", "attributes", "tags" and other important concepts that you may have heard about, as well as their role in the language. We'll also show how HTML elements work, a typical HTML page, and explain other important aspects of the language. Along the way, so you don't get bored, we'll play around with a real HTML page!

Required knowledge: Ability to work with a computer, availability of the necessary software, basic knowledge of working with files.
Purpose: Get to know the HTML language and learn how to describe some of its elements.

HTML (HyperText Markup Language) is not a programming language; it is a markup language used to define the structure of web pages visited by users. They can have a complex or simple structure, it all depends on the intention and desire of the web developer. HTML is made up of a number of elements that you use to span, wrap, or mark up different pieces of content so that it looks a certain way or works in a certain way. Inline tags can turn a piece of content into a hyperlink that can take you to another web page, italicize words, and so on. For example, consider the following string:

 My cat is very angry 

If we want the string to appear like this, we can define it as a "paragraph" by enclosing it in the tags of the "paragraph" element (

), for example:

 

My cat is very angry

Note : HTML tags are case insensitive, meaning they can be written in upper or lower case. For example, the tag </code> could be written as <code> <title> </code> , <code> <TITLE> </code> , <code> <Title> </code> , <code> <TiTlE> </code> , etc., and it will work just fine.<img loading='lazy' src='/800/600/http/i.stack.imgur.com/Fs9Ah.png' /> The best practice, however, is to write all tags in lowercase for consistency, readability, and other reasons. </p> <p> Let's look at the "paragraph" element in a little more detail: </p> <p> </p> <p> The main parts of the element are: </p> <ol> <li> <strong> The opening tag: </strong> It consists of the name (designation) of the element (in our case, p), placed inside <strong> angle brackets </strong> . This tag marks the beginning of an element, from that moment the tag begins to affect the content that follows it. </li> <li> <strong> Closing tag: </strong> looks like the opening tag, but contains a slash before the tag name. It serves as a sign of the end of the element. Omitting closing tags is a common rookie mistake that can lead to ambiguous results - in the best case, everything will work correctly, in others the page may not be drawn at all or may not be drawn as expected. </li> <li> <strong> Content: </strong> As you can see, in our case the content is plain text. </li> <li> <strong> Element: </strong> start tag + end tag + content = element.<img loading='lazy' src='/800/600/http/althos.com/Tutorial/images/Web-Site-Design-tutorial-what-is-HTML.jpg' /> </li> </ol> <h4> Active learning: creating your first HTML element </h4> <p> Edit the line of text below in the <em> Input </em> field, wrapping it with the <code> <em> </code> and <code> </em> </code> tags (insert <code> <em> </code> before the line to make <em> specify the beginning of element </em> , and <code> </em> </code> after it to <em> indicate the end of the element </em> ) - these actions should italicize the line of text! You can see real time changes in field <em> Output </em> . </p> <p> If you make a mistake, you can always start again using the button <em> Reset </em> . If the exercise is difficult for you, then click the button <em> Show solution </em> to see the correct answer. </p> <h4> Nested elements </h4> <p> You can also nest elements inside other elements - this is called <strong> nesting </strong> . If we want to emphasize that our cat <strong> is very </strong> angry, we can enclose the word "very" in a <code> <strong> </code> element, which means that this word is extremely important in this context: </p> <pre> <p>My cat is <strong> very</strong> angry.<img loading='lazy' src='/800/600/http/i.ytimg.com/vi/Xz7y0pb53Ek/hqdefault.jpg' /> </p> </pre> <p> You have to make sure the elements are nested properly: in the following example we open element <code> p </code> first, then element <code> strong </code> , then we close element <code> strong </code> first, then <code> p </code> . The following is incorrect: </p> <pre> <p>My cat is <strong>very angry.</p></strong> </pre> <p> Elements must open and close correctly so that they are clearly inside or outside of each other. If they overlap as in the example above, then your browser will try to "think" for you what you meant, and you will get unpredictable results. So don't do it! </p> <h4> Block and inline elements </h4> <p> There are two important categories of elements in HTML that you should be aware of - block-level elements and inline elements. </p> <ul> <li> Block-level elements form a visible block on the page - they will appear on a new line after any content that came before them, and any content after them will also appear on a new line. Most often, block-level elements are structural elements of the page, which are, for example, paragraphs (paragraphs), lists, navigation menus, footers, or footers, etc.<img loading='lazy' src='/800/600/http/4.bp.blogspot.com/-cfDLfHXAPtw/WM7jkWLGwcI/AAAAAAAACfM/was9JNZESwIso6uH2EpWO1WWFYJCowKbACLcB/w1200-h630-p-k-no-nu/Display%2BSelected%2BHTML%2BTable%2BRow%2BIn%2BInput%2BText%2BUsing%2BJavaScript.png' /> Block-level elements are not nested in inline elements, but sometimes they can be nested in other block-level elements. </li> <li> Inline elements are those contained within block-level elements that surround only small portions of document content, not entire paragraphs and groupings of content. Inline elements do not result in a new line in the document: they usually occur within a paragraph of text, such as the <code> <a> </code> (link) element, or accent elements like <code> <em> </code> or <code> <strong> </code> . </li> </ul> <p> Look at the following example: </p> <pre> <em>First</em><em>Second</em><em>Third</em> <p>fourth</p><p>fifth</p><p>sixth</p> </pre> <p> <code> <em> </code> is an inline element, so as you can see here, the first three elements are on the same line as each other with no spaces between them. On the other hand, <code> <p> </code> is a block-level element, so each element is on a new line, with space above and below each (this spacing is determined by the default CSS styling that browsers apply to paragraphs).<img loading='lazy' src='/800/600/http/i.stack.imgur.com/ZQ3Jh.png' /> </p> <p> <strong> Note </strong> : HTML5 redefined element categories in HTML: see Element Content Type Categories. Although these definitions are more precise and unambiguous than those that came before, they are much more difficult to understand than "block" and "inline", so we will stick to them in this section. </p> <p> <strong> Note </strong> : Do not confuse the terms "block" and "inline" used in this section with CSS display types of the same name. Although they are correlated by default, changing the display type in CSS does not change the element's category, nor does it affect what it can be nested in and what can be nested in it. This rather common confusion is one of the reasons why HTML5 has abandoned these terms. </p> <p> <strong> Note </strong> : You may find references that include lists of block and inline elements to be useful - see Block-Level Elements and Inline Elements. </p> <h4> Empty elements </h4> <p> Not all elements match the above pattern: start tag, content, end tag.<img loading='lazy' src='/800/600/http/i.ytimg.com/vi/w0sTNMzpJn4/hqdefault.jpg' /> Some elements consist of a single tag and are usually used to insert something in the document where they are placed. For example, the element <code> <img> </code> inserts an image on the page in the exact place where it is located: </p> <pre> <img src="https://raw.githubusercontent.com/mdn/beginner-html-site/gh-pages/ images/firefox-icon.png"> </pre> <p> This will output the following to your page: </p> <p> <strong> Note </strong> : Empty elements are sometimes called <em> void elements </em> . </p> <p> Elements can also have attributes that look like this: </p> <p> </p> <p> Attributes contain additional information about the element that you don't want to appear in the element's content. In this case, the <code> class </code> attribute allows you to give the element an identifying name that can later be used to refer to the element with style information and other things. </p> <p> The attribute must have: </p> <ol> <li> A space between the attribute and the element name (or the previous attribute if the element already has one or more attributes).<img loading='lazy' src='/800/600/http/i.stack.imgur.com/rHj1x.png' /> </li> <li> The attribute name followed by an equals sign. </li> <li> The value of the attribute enclosed in quotation marks. </li> </ol> <h4> Active Learning: Adding Attributes to an Element </h4> <p> Take element <code> <a> </code> as an example — stands for anchor and makes the text inside it a hyperlink. Can have multiple attributes, here are a few: </p> <ul> <li> <code> href </code> : The value of this attribute is set to the web address you want the link to point to when you click on it. For example, <code> href="https://www.mozilla.org/" </code> . </li> <li> <code> title </code> : The <code> title </code> attribute describes additional information about the link, such as which page it leads to. For example, <code> title="The Mozilla homepage" </code> . It will appear as a tooltip when you hover over the link. </li> <li> <code> target </code> : The <code> target </code> attribute specifies the browsing context that will be used to display the link. For example, <code> target="_blank" </code> will display the link in a new tab.<img loading='lazy' src='/800/600/http/images.slideplayer.com/23/6879165/slides/slide_1.jpg' /> If you want to display the link in the current tab, simply omit this attribute. </li> </ul> <p> Change the line of text below in field <em> Enter </em> to point to your favorite website. First add the element <code> <a> </code> then the attribute <code> href </code> and attribute <code> title </code> . Finally, set the <code> target attribute to </code> to open the link in a new tab. You can see the changes made in real time in field <em> Output </em> . You should see a hyperlink that, when hovered over, displays the contents of the <code> title </code> attribute, and when clicked, navigates to the address in the <code> href </code> attribute. Remember that there must be a space between the element name and each of the attributes. </p> <p> If you make a mistake, you can always start again using button <em> Reset </em> . If the exercise is difficult for you, then click the button <em> Show solution </em> to see the correct answer. </p> <h4> Boolean attributes </h4> <p> Sometimes you will see attributes written without a value - this is perfectly acceptable.<img loading='lazy' src='/800/600/http/i.pinimg.com/736x/e5/99/52/e59952f7229180e3316ec68436d6091d.jpg' /> Such attributes are called booleans, and they can only have one value, which is basically the same as its name. As an example, let's take the attribute <code> disabled </code> , which can be assigned to render input elements if you want them to be disabled (inactive) so that the user cannot enter any data into them. </p> <pre> <input type="text" disabled="disabled"> </pre> <p> For the sake of brevity, it's perfectly acceptable to write them like this (we've also placed an undisabled input element for reference to give you a better idea of ​​what's going on): </p> <pre> <input type= "text" disabled> <input type="text"> </pre> <p> Both outputs will look like this: </p> <h4> Omitting quotes around attribute values ​​</h4> <p> As you browse the web, you will encounter various unfamiliar ways of writing markup, including writing attribute values ​​without quotes. This is valid under certain conditions, but will break your markup under others. For example, going back to our hyperlink exercise, we could write the main variant with only the attribute <code> href </code> like this: </p> <pre> <a href=https://www.<img loading='lazy' src='/800/600/http/img.youtube.com/vi/a5gU2KDPa9g/0.jpg' /> mozilla.org/>favorite website</a> </pre> <p> However, as soon as we add the <code> title attribute </code> in the same style, we will do wrong : </p> <pre> <a href=https://www.mozilla.org/ title=The Mozilla homepage>favorite website</a> </pre> <p> At this point, the browser will misinterpret your markup, thinking that the <code> title attribute </code> is on actually three different attributes - a title attribute with a value of "The" and two boolean attributes: <code> Mozilla </code> and <code> homepage </code> . This is obviously not what was meant and will result in an error or unexpected code behavior, as shown in the live example below. Try hovering over the link to see what the title text looks like! </p> <p> Our advice: always use quotes in attributes - this will avoid such problems and, therefore, the code will be more readable. </p> <h4> Single quotes or double quotes? </h4> <p> In this article, you will notice that all attributes are enclosed in double quotes. However, you may see single quotes in other people's HTML documents.<img loading='lazy' src='/800/600/http/4.bp.blogspot.com/-xvAEME1PkYQ/WE8B-CAP-uI/AAAAAAAABnQ/L4Fb9QmDObgJmXiXB6goRzpHqJmiroazwCLcB/s1600/html2fo_2.jpg' /> This is purely a matter of taste and you are free to choose which ones you prefer. Both of the following lines are equivalent: </p> <pre> <a href="http://www.example.com">Link to my example.</a> <a href='http://www.example.com'>Link to my example.</a> </pre> <p> However, you need to make sure you don't mix them together. The following will be wrong! </p> <pre> <a href="http://www.example.com'>Link to my example.</a> </pre> <p> If you use one type of quotation mark in your HTML, you can put another type of quotation mark inside it, not causing no problems: </p> <pre> <a href="http://www.example.com" title="Isn't this fun?">A link to my example.</a> </pre> <p> If you want to insert quotes of the same type, then you must use HTML entities. For example, this won't work: </p> <pre> <a href='http://www.example.com' title='Isn't this fun?'>A link to my example.</a> </pre> <p> So you need do this: </p> <pre> <a href='http://www.example.com' title='Isn't this fun?'>A link to my example.</a> </pre> <p> Below is an example of wrapping the main , standalone HTML elements that aren't very useful on their own.<img loading='lazy' src='/800/600/http/luxe-host.ru/wp-content/uploads/6/f/d/6fdc6d0ece245b907d0b576f0b144b07.png' /> Let's see how the individual elements are combined to form the entire HTML page:0003 <pre> <!DOCTYPE html> <html> <head> <metacharset="utf-8"> <title>Test page

This is my page

This is what we have:

  1. : Document type declaration. A long time ago, back when HTML was young (1991/2), document types were used as references to a set of rules that an HTML page had to follow in order to be considered good, which could mean automatic error checking and other useful things. The document type declaration looked something like this:
      
    However, no one thinks much about them these days, and document types have become a historical artifact that must be included everywhere for everything to work properly. is the shortest kind of document type that is considered valid. In fact, that's all you need to know about document types.
  2. : The element contains all the content on the entire page, and is sometimes referred to as the "root element".
  3. : Element . This element acts as a container for all the content that you want to include in your HTML document but don't want to be shown to visitors to your page. It includes things like the keywords and page description you'd like to show up in search queries, CSS to style your content, declaration of the supported character set, and more. You will learn more about this in the next article of this guide.
  4. : This element sets the character encoding for your document to utf-8 , which includes most characters from all languages ​​known to mankind. Essentially, the page will now be able to display any textual content that you can attach to it. There is no reason not to set this encoding, it will also avoid some problems later.
  5. : Item </code> . This element sets the title of your page that appears in the browser tab that loads this page, and this title is also used to describe the page when you bookmark or favorite it. </li> <li> <code> <body></body> </code> : Element <code> <body> </code> . It contains <em> all the content that you want to show to your page visitors - text, images, videos, games, audio tracks to play, or whatever. </li> </ol> <h4> Active learning: Adding elements to your HTML document </h4> <p> If you want to experiment with writing HTML on your computer, you can: </p> <ol> <li> Copy the sample HTML page above. </li> <li> Create a new file in a text editor. </li> <li> Paste the code into your new text file. </li> <li> Save file as <code> index.html </code> . </li> </ol> <p> <strong> Note </strong> : You can also find this basic HTML example on the MDN Learning Area Github repo. </p> <p> Now you can open the browser and see what the code was rendered into, and then change it, refresh the page and see what happened.<img loading='lazy' src='/800/600/http/img.youtube.com/vi/D9VqgB3uYOc/hqdefault.jpg' /> The page first looks like this: </p> <p> <br/> For this exercise, you can edit the code locally on your computer as suggested above, or you can work in the editor below. The editor only shows the content of the <code> <body> </code> element. Try this: </p> <ul> <li> Add the title of the page just after the opening tag <code> <body> </code> . The text must be between the opening tag <code> <h2> </h2></code> and the closing tag <code> </h2> </code> . </li> <li> Write in a paragraph about something that seems interesting to you. </li> <li> Highlight important words by wrapping them in an opening tag <code> <strong> </code> and an closing tag <code> </strong> </code> </li> <li> Add a link to your paragraph as explained earlier in the article. </li> <li> Add an image to your document below the paragraph as explained earlier in the article. If you can use another picture (from your computer or from the Internet). You are a great guy! </li> </ul> <p> If you get confused, you can always run the example from the beginning with the button <em> Reset </em> .<img loading='lazy' src='/800/600/http/i.stack.imgur.com/u05cx.png' /> Give up - see the answer by clicking on <em> Show solution </em> . </p> <h4> HTML spaces </h4> <p> You may have noticed that the code examples in this article have a lot of spaces. This is not necessary at all - the following two examples are equivalent: </p> <pre> <p>Dogs are stupid.</p> <p>Dogs stupid.</p> </pre> <p> No matter how much white space you use in your markup (which can include spaces and line breaks): the browser will parse all white space to a single space. Why use lots of spaces? The answer is: it's easy to understand - it's much easier to figure out what's going on in your code if it's conveniently formatted, and not just put together in one big mess. In our code, each nested element is indented by two spaces relative to the element in which it resides. You can use any formatting (in particular, the number of spaces to indent), but it's best to stick to one style. </p> <p> In HTML, the characters <code> < </code> , <code> > </code> , <code> " </code> , <code> ' </code> and <code> & </code> are special characters.<img loading='lazy' src='/800/600/http/img.youtube.com/vi/l7Gz5aJdHwY/0.jpg' /> They are part of the HTML syntax itself. So how do you include one of these special characters in your text? For example, if you want to use an ampersand or less-than sign and not interpret it as a code </p> <p> We must use mnemonic links - special codes that display special characters and can be used in the required positions.Each mnemonic link starts with an ampersand (&) and ends with a semicolon (;).0003 <p/> <table> <thead> <tr> <th scope="col"> Letter character </th> <th scope="col"> Character equivalent </th> </tr> </thead> <tbody> <tr> <td> < </td> <td> < </td> </tr> <tr> <td> > </td> <td> > </td> </tr> <tr> <td>" </td> <td>" </td> </tr> <tr> <td> '</td> <td>' </td> </tr> <tr> <td> & </td> <td> & </td> </tr> </tbody> </table> <p> In the following example, you see two paragraphs that talk about web technologies: </p> <pre> <p>In HTML, you define a paragraph with a <p> element.</p> <p>In HTML, you define a paragraph with a <p">> element.<img loading='lazy' src='/800/600/http/i.stack.imgur.com/vGoW7.png' /> </p> </pre> <p> In the live output below, you may notice that the first paragraph is rendered incorrectly because the browser thinks the second element is <code> <p> </code> </p> <p> <strong> Note </strong> : A table of all available HTML entity references - Wikipedia: List of XML and HTML character entity references. </p> <p> In HTML, as in most programming languages, it is possible to write comments in the code. Comments are ignored by the browser and not visible to the user, they are added to explain how the written code works, what certain parts of it do, etc. This practice is useful if you return to code that you have not seen for a long time or when you want to transfer it to someone else. </p> <p> To turn part of the content of an HTML file into a comment, you need to put it in special markers <code> <!-- </code> and <code> --> </code> eg: </p> <pre> <p> I'm not in the comments( </p> <!-- <p>And now there is!</p> --> </pre> <p> As you will see below, the first paragraph will be displayed on the screen, but the second one will not.<img loading='lazy' src='/800/600/http/i.pinimg.com/736x/92/92/08/9292089793de1ce206e3299e9c2673c3.jpg' /> <table><hr><h4 class="relpost">Learn more</h4> <ul class="relpost"> <li><a href="/misc/clean-grease-off-stove-grates.html" title="Clean grease off stove grates"><div class="relimg"><img loading="lazy" src="/800/600/http/i.pinimg.com/originals/20/fc/42/20fc428abf4bbc20650a9a47b674c57c.jpg" /></div>Clean grease off stove grates</a></li> <li><a href="/misc/tips-for-organizing-closets.html" title="Tips for organizing closets"><div class="relimg"><img loading="lazy" src="/800/600/http/i.pinimg.com/736x/d3/8a/6a/d38a6ace5da4d9aa151153d053757c0a.jpg" /></div>Tips for organizing closets</a></li> <li><a href="/misc/small-bedrooms-inspiration.html" title="Small bedrooms inspiration"><div class="relimg"><img loading="lazy" src="/800/600/http/i.pinimg.com/736x/08/3f/8e/083f8e9c2af707b05d848cf66d72a367.jpg" /></div>Small bedrooms inspiration</a></li> <li><a href="/misc/dark-marble-bathrooms.html" title="Dark marble bathrooms"><div class="relimg"><img loading="lazy" src="/800/600/http/i05.fotocdn.net/s131/99111c2f9ad15ca3/public_pin_l/2947772144.jpg" /></div>Dark marble bathrooms</a></li> <li><a href="/misc/wall-painting-colours-images.html" title="Wall painting colours images"><div class="relimg"><img loading="lazy" src="/800/600/http/i.pinimg.com/736x/a9/b8/c2/a9b8c20e35a77762f8c5730e079f548d.jpg" /></div>Wall painting colours images</a></li> <li><a href="/misc/things-to-cook-in-the-air-fryer.html" title="Things to cook in the air fryer"><div class="relimg"><img loading="lazy" src="/800/600/http/i.pinimg.com/originals/3b/5e/e2/3b5ee237866fff65d603e517439fef95.jpg" /></div>Things to cook in the air fryer</a></li> <li><a href="/misc/where-to-plant-kale.html" title="Where to plant kale"><div class="relimg"><img loading="lazy" src="/800/600/http/circlealettuce.com/wp-content/uploads/Hydroponic-Kale-700x525.jpg" /></div>Where to plant kale</a></li> <li><a href="/misc/cut-back-peonies-in-fall.html" title="Cut back peonies in fall"><div class="relimg"><img loading="lazy" src="/800/600/http/phonoteka.org/uploads/posts/2021-06/thumbs/1625016537_31-phonoteka_org-p-rozovie-pioni-oboi-krasivo-31.jpg" /></div>Cut back peonies in fall</a></li> <li><a href="/misc/refinishing-kitchen-cabinet.html" title="Refinishing kitchen cabinet"><div class="relimg"><img loading="lazy" src="/800/600/http/i.pinimg.com/originals/19/45/46/19454675c5008311f87a36f692330daa.jpg" /></div>Refinishing kitchen cabinet</a></li> <li><a href="/misc/best-toaster-oven-for-broiling.html" title="Best toaster oven for broiling"><div class="relimg"><img loading="lazy" src="/800/600/http/img.alicdn.com/imgextra/i1/345244248/TB2aYUVbFXXXXb1XpXXXXXXXXXX_!!345244248.jpg" /></div>Best toaster oven for broiling</a></li> <li><a href="/misc/storage-for-small-hallway.html" title="Storage for small hallway"><div class="relimg"><img loading="lazy" src="/800/600/http/i.pinimg.com/originals/b2/56/89/b256893c3cb288b8473850498e350be6.png" /></div>Storage for small hallway</a></li> </ul></table>