In this tutorial, you will learn HTML Text Formatting
Text formatting in HTML allows you to control the appearance of text on a web page. The following are some common ways to format text in HTML:
- Bold text: To make text bold, you can use the
<strong>
or<b>
tags. For example,<strong>this text will be bold</strong>
or<b>this text will be bold</b>
will display as “this text will be bold” in the browser. - Italic text: To make text italic, you can use the
<em>
or<i>
tags. For example,<em>this text will be italic</em>
or<i>this text will be italic</i>
will display as “this text will be italic” in the browser. - Underlined text: To underline text, you can use the
<u>
tag. For example,<u>this text will be underlined</u>
will display as “this text will be underlined” in the browser. - Strikethrough text: To strike through text, you can use the
<s>
or<strike>
tags. For example,<s>this text will have a strikethrough</s>
or<strike>this text will have a strikethrough</strike>
will display as “this text will have a strikethrough” in the browser. - Changing text size: You can control the size of text using the
<font>
tag and the “size” attribute. The value of the size attribute can be an absolute number (1-7) or a relative value (“+1” or “-1”). For example,<font size="3">This text will be size 3</font>
will display as “This text will be size 3” in the browser. - Changing text color: You can control the color of text using the
<font>
tag and the “color” attribute. The value of the color attribute should be a color name or hex code. For example,<font color="red">This text will be red</font>
will display as “This text will be red” in the browser. - Headings: HTML has six levels of headings, which are defined the
<h1>
through<h6>
tags. H1 is the highest level heading and H6 is the lowest. for example,<h1> This is a heading 1</h1>
<h2> This is a heading 2</h2>
This is a basic tutorial on text formatting in HTML, and there are many other ways to format text using CSS. HTML and CSS work together to create the desired style and layout for your web page.