Docsity

Overview of HTML Basics and Structure, Study notes of Computer Science

Toggle sidebar
bg1
INTRODUCTION TO PARAGRAPHS IN HTML
1. PARAGRAPHS
1.1 In essence, a paragraph is a group of words and punctuation. It enables us to
organise and present textual data clearly and understandably. A paragraph
element is created using the HTML <P> tag.
1.2 Why Paragraph Tag
In HTML, a paragraph is just a text block that is encapsulated in a <p> tag.
The <p> tag aids in breaking up content into digestible chunks.
It serves as the main component for enclosing text on a webpage that is intended
to be seen as a separate paragraph.
The <p> tag in HTML is used to define a paragraph of text.
To make the text easier to read, browsers automatically add a margin (space)
before and after each paragraph.
By improving the text's overall appearance on the page, this spacing facilitates
readers' interaction with the content.
The layout and readability of your web content can be greatly enhanced by
knowing how to use tagging effectively.
Syntax of the Paragraph tag,
<p>Write your paragraph text here. </p>
For example,
<!DOCTYPE html>
<html>
<head>
<title>Paragraph Example</title>
</head>
<body>
<h2>About HTML</h2>
<p>HTML stands for HyperText Markup Language. It is used to create web
pages.</p>
<p>Each paragraph is written inside the &lt;p&gt; and &lt;/p&gt; tags.</p>
</body>
pf3
pf4
pf5
pf8

Partial preview of the text

Download Overview of HTML Basics and Structure and more Study notes Computer Science in PDF only on Docsity!

INTRODUCTION TO PARAGRAPHS IN HTML

1. PARAGRAPHS

1.1 In essence, a paragraph is a group of words and punctuation. It enables us to organise and present textual data clearly and understandably. A paragraph element is created using the HTML

tag. 1.2 Why Paragraph Tag  In HTML, a paragraph is just a text block that is encapsulated in a

tag.  The

tag aids in breaking up content into digestible chunks.  It serves as the main component for enclosing text on a webpage that is intended to be seen as a separate paragraph.  The

tag in HTML is used to define a paragraph of text.  To make the text easier to read, browsers automatically add a margin (space) before and after each paragraph.  By improving the text's overall appearance on the page, this spacing facilitates readers' interaction with the content.  The layout and readability of your web content can be greatly enhanced by knowing how to use tagging effectively. Syntax of the Paragraph tag,

Write your paragraph text here.

For example,

Paragraph Example

About HTML

HTML stands for HyperText Markup Language. It is used to create web pages.

Each paragraph is written inside the <p> and </p> tags.

The Output is: 1.2 Key Points:  Every paragraph needs to begin with

and end with

.  A line break in browsers automatically follows every paragraph.  Paragraphs can be styled with CSS (text colour, alignment, font size, etc.).HTML Line Break With Paragraph 1.3 The Break
Tag The

tag stands for “line break”. It is used to start a new line of text without beginning a new paragraph. Syntax,
or

1.5 Key Points:
adds a single line break in text.  The
tag doesn’t have a closing tag.  Often used inside paragraphs, poems, or addresses.  Example in poems: 

Twinkle, twinkle, little star,
How I wonder what you are!

1.4 The Horizontal rules tag  The tag stands for Horizontal Rule.  It is used to insert a horizontal line or ruler (a divider) across the webpage, usually to separate sections of content. Syntax:

The tag is an empty tag , meaning it does not have a closing tag. The Output is:

1.6 Key Points:  Between content sections, establishes a thematic break.  It is frequently employed to divide subjects visually.  You can use CSS (colour, width, thickness, and alignment) to style it. Styled Example:

This creates a blue horizontal line that is 60% wide and 3px thick.

2. HTML Style Element  CSS (Cascading Style Sheets) can be added directly within an HTML document using the
 Used for quick styling of a single element. Example:

This is an inline styled paragraph.

**Advantages:**  Easy to apply to one element. **Disadvantages:**  Not reusable.  Hard to maintain if many styles are used.  **External CSS**  CSS is written in a **separate** .css **file** and linked using the **tag** in .  Used for **styling multiple webpages** consistently.

External CSS Example

This paragraph is styled using an external CSS file.

CSS file (styles.css) body { background-color: lightpink; } h1 { color: purple; } p { font-size: 18px; color: navy; } Advantages: One file can control styles for multiple pages. Easier to maintain and update. Disadvantages: Requires an external file (may take extra loading time).

3. Comments Used in HTML

HTML comments are not displayed in the browser, but they can help document your HTML source code. Syntax,

This is a paragraph.

3.1 Hide Content Comments can be used to hide content. This can be helpful if you hide content temporarily:

This is a paragraph.

3.2 Type of Comments I. Multi-line Comment

II. /*

Look at this cool image:

*/ III. Single Line Comment //

Look at this cool image:

//