HTML codes for text formatting: insert paragraph & Co.
Related Videos: HTML Tutorial 2 - Adding and Spacing Text (May 2024).
Text formatting in HTML works very differently than in Word or LaTeX. Use different codes for paragraph, line breaks and Co. In this practical tip, we present the most important tags for a browser-friendly structure and design of your text in HTML.
How to structure the text in HTML
Many manual text formatting is simply ignored in HTML. They have to be coded explicitly in order to be interpreted correctly by the browser.
- You create paragraphs by deleting a paragraph in the paragraph environment with "
"initiate and by"
" break up. - You then do not need to make line breaks between paragraphs; between two paragraphs, the line breaks are created automatically.
- You can define the text alignment in the paragraph environment. Left Justify | Right Justify | Justify just like this: "
" to ""
- Caution: Text formatting in the Paragraph environment does not work in HTML5. Alternatively, use CSS stylesheets and the code "
, We show you how to embed CSS in HTML5.
- Alternatively, center individual lines of text or entire paragraphs in the center environment: "" to ""
- Within a paragraph or if you would like to insert one or more line breaks manually, you can do this via "
". That stands for" brake row ", but maybe you will remember it better than the" break "of" break ". - You can simply insert a space using the space key. To make several spaces in a row, write "" several times. This is the "non-breaking space".
- If you want to make sure that a line of text is not separated by an automatic line break, use the no-break environment: "" around the text that should not be separated ""
- One trick to take over the typed text formatting is the predefined environment: Write between "
"and" "Text with line breaks or several spaces in a row, this formatting is adopted.
- You can also choose a relatively free range of your HTML source text through the division environment "
Format "and" "specially.
- For example "
"for text alignment, or
to assign a color to the area via hex code.
- Warning: The division environment does not work in HTML5 either.
- The different hierarchies of the headings are important for structure and SEO:
Title of the page,
Title of a chapter,
Section title,
Title of a subsection, ... that goes up
,
- The following applies here: the smaller the number, the more important and larger the heading.
How to format the text in HTML
You can of course also design the text itself in HTML:
- Text that is between " " and "" in the Bold environment is written in bold.
- Accordingly, italicize " " and "" in the Italic environment .
- The underline environment "" to "" underlines your text. Underlining is rarely used in internet texts because it could be misunderstood as a link.
- We have our own practical tip that explains in detail how to change the font size of the body text in HTML.
- To change the font, follow the instructions in our practical tip.
Plan to use HTML5, get started with our HTML5 tutorial and optimize your website's design and content with our SEO tips.