TEXT IN HTML

In HTML (Hypertext Markup Language), you use markup tags to structure and format text on a webpage. Here’s an example of basic text formatting in HTML:

<!DOCTYPE html>
<html>
<head>
<title>My Webpage</title>
</head>
<body>
<h1>This is a Heading</h1>
<p>This is a paragraph. Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>

<h2>This is a Subheading</h2>
<p>Another paragraph with some <em>emphasized</em> text and <strong>strongly emphasized</strong> text.</p>

<h3>This is another Subheading</h3>
<ul>
<li>Item 1</li>
<li>Item 2</li>
<li>Item 3</li>
</ul>

<h4>This is a Sub-subheading</h4>
<ol>
<li>First item</li>
<li>Second item</li>
<li>Third item</li>
</ol>

<p><a href=”https://www.example.com”>This is a link</a> to an example website.</p>
</body>
</html>

Explanation:

  • <!DOCTYPE html> specifies the document type and version.
  • <html> is the root element of the HTML document.
  • <head> contains meta-information about the document (e.g., title, links to stylesheets).
  • <title> sets the title of the webpage displayed in the browser’s title bar or tab.
  • <body> contains the visible content of the webpage.
  • <h1> to <h6> create heading elements, with <h1> being the highest level and <h6> the lowest.
  • <p> creates a paragraph element.
  • <em> is used to emphasize text (usually displayed in italics).
  • <strong> is used to strongly emphasize text (usually displayed in bold).
  • <ul> creates an unordered list (bullet points).
  • <li> creates list items within an unordered or ordered list.
  • <ol> creates an ordered list (numbered items).
  • <a> creates an anchor element for creating links, with the href attribute specifying the URL to link to.

Remember, this is just a basic example, and there are many more HTML tags and attributes available for more complex web pages. HTML provides the structure, and you can apply CSS (Cascading Style Sheets) to control the appearance and layout of the content.

Leave a Reply

Your email address will not be published. Required fields are marked *