How to use HTML special characters

HTML special characters are used to display elements that are not available on a regular keyboard. It can be various signs, for example, copyrights or paragraph designation. Special characters always begin with an element called ampersand and end with a semicolon. In this article, we will look at a few basic groups of special HTML characters.

html special characters

Structure

As mentioned above, html special characters always begin with an ampersand. Not everyone is familiar with this element, but don't be alarmed. Surely the β€œ&” sign is familiar to many - this is exactly what an ampersand looks like. You can apply it using the key combination Shift + 7 (with English layout). You may know this element under a different name. What a semicolon looks like, I hope everyone knows. "& Nbsp;" - This is one example of writing special characters in HTML.

General special characters

The most commonly used characters fall into this category. One of them you saw earlier - "& nbsp;" which means an inextricable space. You must have often met this sign: "Β©", which is copyright (or authorship). It can be seen at the very bottom on many sites, followed by the name of the author or company. This group also includes such interesting elements as fractional numbers. For example: ΒΌ - β€œ& frac14;” or Β½ - "& frac12;" We all saw a dollar sign on the keyboard , and have you ever met the euro? In HTML, special characters allow authors to provide such an element to users, all thanks to the "& euro;" This group also includes such signs as degrees (Β°), plus or minus (Β± plus), trademark (Β± trade), function (Β± f), multiplication (Β±), division (& divide;), etc. d.

Punctuation special characters

This group contains special characters that emulate punctuation marks. For example, the ellipsis is β€œ& hellip;” or a long dash - "& mdash;". Let it not surprise you that many of the characters in this group can be typed on the keyboard. After all, then, in fact, the whole meaning of using such elements is lost. Further in the article there will be a logical explanation for this.

html special characters

Arrows

Sometimes web page developers need to add very rare HTML special characters. Arrows - these are the elements that are used to logically build navigation or just for decoration. This group consists of five different characters. Namely: the left arrow is β€œ& larr;”, the right is β€œ& rarr;”, the up is β€œ& uarr;”, the down is & quot; & darr; ”, while the left and right are & quot; & harr;".

html arrow special characters

additional information

Of course, there are other special HTML characters. But it makes no sense to describe each of them individually, as specialized reference books have already done this. Let us return to the question of why such special characters as quotation mark (& lsquo;), dash (& ndash;), inextricable space (& nbsp;), etc. are needed. They are used for the correct display of elements by the browser. After all, the interpreter may misunderstand the author. For example, you want to put a description of the <table> tag on your site. If you put just such an entry, the browser will think that the table starts here, and that this is not just text. To avoid misunderstandings, you must use special HTML characters. In this case, the entry will be as follows: & lt; (denotes a less than) table & gt; (indicates a greater than sign). Other similar elements are used for the same reasons. For example, & nbsp; It is used when you need to add extra spaces, since the browser usually ignores most of them.

Source: https://habr.com/ru/post/K1838/


All Articles