What does italics look like? Basic HTML text formatting tags - highlighting text in bold and italics; size, color and font options; paragraph and heading tags

Italic font is one of the most popular ways to highlight a piece of text and give it a certain significance. It is ideal for quotes, footnotes, titles and proper names. There are two special tags in HTML for displaying italics. In CSS, italic is controlled by the font-style property.

Italic or italic font?

The display of the same font in italics may vary.

The picture shows three blocks of text in the same Playfair Display font. The first one is in normal roman style, while the second and third are italic. They are opened in the same Google Chrome browser, but they look completely different.

The fact is that some fonts have their own italic character sets. If the browser does not have access to this set, but encounters text that should be displayed as italic, it will attempt to slant it on its own.

In the second block - just such a browser-processed version, and in the third - the original italic version of the Playfair Display font, which has a unique style, more like a handwritten one. The browser, on the other hand, simply tilts each character of the text at a certain angle, imitating italics.

When figuring out how to make italics in CSS or HTML, it's important to remember that in the case of specific fonts, you need to make sure the browser has access to their italic sets. In some cases, the result of browser tilt algorithms may be unsatisfactory.

HTML cursive

There are two special tags for italic text in HTML: i (from the word italic) and em. The style of a text fragment enclosed in any of these descriptors will be the same.

The difference lies in the logical allocation. The em tag indicates the special significance of the fragment. This is important for search robots and screen readers, which will highlight the specified text using intonation.

font-style property

In CSS, italic is controlled by the font-style statement. It can take one of three basic values:

  • normal - normal font;
  • italic - italic style;
  • oblique - oblique style.

Currently, most modern browsers treat oblique and italic values ​​the same way, but it was originally assumed that the former was the result of special browser algorithms that slant each character to the right.

If the font you are looking for is not found by the browser, then italic will look exactly the same as oblique.

Unlike the em tag, it does not give the highlighted fragment special importance, it rather corresponds to the i descriptor.

Examples

Quotations are often highlighted in italics. Let's try to make it look nice.

Quote ( font-style: italic; border-left: 5px solid purple; padding-left: 20px; )

In addition to the decorative border on the right and padding, the quote block has a font-style rule with a value of italic.

It sets italic CSS.

Now we will study the main tags. Let's start with what tags are required on the page, forming its structure.

Block . The structure of the simplest page

The site page is a plain text file with the extension .html. Inside this file, the text of the HTML page is stored along with tags. This file must have the following tags: tag , which should contain the text of the entire site (everything that is written outside this tag will be ignored by the browser), and inside it there should be two more tags: tag for page service content and tag - for the main text, which is visible on the browser screen.

In service content, which is located inside the tag , many different things come in, but for now we only need two of them. This is a tag , which specifies the title of the page that will be visible in the browser tab, and the tag <meta>, which specifies the page encoding (it is set in the attribute <b>charset</b> and usually matters <b>utf-8</b>, more about this in the video, which will be a couple of paragraphs lower).</p> <p>Also, before the tag <html>construction is usually written <b>doctype</b>, which specifies the version of the HTML language in which the site is made. The current version of the language is number five and the doctype for it should look like this -<!DOCTYPE html> .</p> <p>So let's look at the basic structure of the page (to run this example in a browser - copy it into a text file with the extension <b>.html</b> and open in a browser, if you have problems with this - watch the video below an example):</p> <p> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>This is title title This is the main content of the page.

How this example looks in the browser, see this link.

I think after you read about the basic structure of the page, you still have some confusion about how it all looks in practice. Therefore, I made a special video in which I will show you how to make your first HTML page and run it in a browser (in it I will also talk about the title of the page, about encodings, about code design). Watch it and only then proceed to further reading:

Well, now, having learned how to create the simplest pages, we will move on to learning useful tags that should be used inside the tag . These will be tags for paragraphs, headings, lists, links, and other useful things. So let's get started.

Block . paragraphs

One of the main elements of the page are paragraphs. They can be compared to paragraphs in a book - each paragraph starts on a new line and has a so-called red line (this is when the first line of the text of the paragraph indents slightly to the right). By default, there is no red line, but it is easy to do (more on that later).

A paragraph is created using a tag

Thus:

This is title title

This is a paragraph.

This is another paragraph.

And one more paragraph.



This is a paragraph.

This is another paragraph.

And one more paragraph.

Block . Headings h1, h2, h3, h4, h5, h6

In addition to paragraphs, important on the page are headlines. They can also be compared to headings from a book - each chapter has its own heading (the title of this chapter) and is divided into paragraphs, which also have their own headings. Well, the main text of the page is in paragraphs.

Headlines are being created using tags

,

,

,

,

,
. They have varying degrees of importance. In the title h1 should have the title of the entire HTML page, V h2- Name blocks pages, in h3- name of subblocks and so on.

All headings are bold by default and have a different size (this can be changed via CSS, but more on that later). See example:

This is title title

Heading h1

heading h2

heading h3

heading h4

heading h5
heading h6

This is the first paragraph.

This is the second paragraph.

This is the third paragraph.



This is how the code will look in the browser:

Heading h1

heading h2

heading h3

heading h4

heading h5
heading h6

This is the first paragraph.

This is the second paragraph.

This is the third paragraph.

Block . Fatty

You already know what the default headers are fatty. However, you can also make plain text bold - just put it in a tag . See example:

This is title title

This is plain text and this is fatty text.



This is how the code will look in the browser:

This is plain text and this is fatty text.

should be used inside some other tag, such as a paragraph. In this case, paragraphs create the overall structure of the page (paragraphs and headings), and the tag b Makes individual pieces of text bold.

Block . Italics

In addition to fatty, you can also do italics using the tag :

This is title title

This is plain text and this is italic text.



This is how the code will look in the browser:

Block . Lists

Along with paragraphs and headings, there is another important element of the page - this lists. Such elements are probably familiar to all Internet users. They represent an enumeration of something (a list) point by point. Next to each list item is usually a filled circle (it is called marker list).

Lists are created with a tag