HTML Basics: Paragraph, Style, Formatting.
Here, we will see the HTML basics of Paragraph, Style, Formatting and how to use it, where to use it, how is written the code in HTML document. And we will see the Live example also.
HTML Paragraph: Usually consisting of a block of text, a paragraph always begins on a new line.
HTML Style: An element can have styles applied to it, including color, font, size, and more, using the HTML style attribute.
HTML Formatting: A number of elements in HTML are available for giving text a specific meaning.
We have already seen this link of HTML Basics with Example, HTML Attributes, HTML Headings
HTML Paragraph
The document type and version are declared using <!DOCTYPE html>.
An HTML page’s root element is <html>
Metadata about the HTML document is contained in the <head> section.
The HTML document’s title is specified via the <title> tag.The HTML document’s content is contained in <body>. <p> denotes a text paragraph.
Live Example
See the Pen
HTML Paragraph by Meena Subash (@Meena-Subash-the-sasster)
on CodePen.
HTML Style
The <style> tag in the <head> section or inline styles inside HTML components can be used to style HTML. Here’s an illustration utilizing both techniques:
Live Example 1:Using Style Tag
See the Pen
HTML Style by Meena Subash (@Meena-Subash-the-sasster)
on CodePen.
Live Example 2: Using Inline Style
See the Pen
Inline style by Meena Subash (@Meena-Subash-the-sasster)
on CodePen.
In these instances:
CSS styles that are applicable to the entire document are defined via the <style> tag in the <head> section of the document.
Using the style tag, inline styles directly apply CSS styles to specific elements.
The paragraph can be styled using either approach, which will alter the text color, font size, font family, background color, and padding.
HTML Formattings
HTML provides a number of formatting options to improve the way text and content are presented. Several typical HTML formatting tags are as follows:
Basic Formating Tags
1.Bold: <b>
or <strong>
2.Italic: <i>
or <em>
3.Underline: <u>
4.Strikethrough: <s>
5.Subscript: <sub>
6.Superscript: <sup>
7.Paragraph: <p>
8.Line Break: <br>
9.Horizontal Line: <hr>
Live Example
See the Pen
Untitled by Meena Subash (@Meena-Subash-the-sasster)
on CodePen.
In this example,
Text is bolded using description <b> and <strong>. while <strong> denotes strong importance and <b> is used for stylistic purposes.
Text is italicized using <i> and <em>. <em>denotes emphasis, whereas <i> serves stylistic purposes.
<u> highlights text. Text is struck through when using<s>.
When writing subscript text, <sub> is typically utilized in mathematical expressions or chemical formulations.
Superscript text is represented by <sup> and is typically used for exponents or footnotes.
A paragraph is defined by <p>.
Adds a line break using <br>.
A horizontal line is inserted with <hr> to divide content parts.
This is a basic overview of HTML paragraphs, styling methods, and common formatting options.