Skip to main content

Command Palette

Search for a command to run...

Frontend Web Development - Basics(Part-2)

Updated
•3 min read•View as Markdown

Paragraphs in HTML

To write paragraphs in HTML you should use <p> tag. A paragraph will always start on a new line, and browsers automatically add some white space before and after a paragraph.

<p> This is first paragraph </p>
<p> This is second paragraph </p>

You cannot be sure how HTML will be displayed, large or small screens, and resized windows will create different outputs. In HTML, you cannot change the display by adding extra spaces or extra lines in your HTML code. The browser will automatically remove any extra spaces and lines when the page is displayed. Refer the below code:

<p>
All the
Extra spaces
or extra lines will
be removed.
</p>

Horizontal Rules <hr> tag in HTML

Whenever this <hr> tag is used, it will create a horizontal line in webpage. This tag defines a thematic break in an HTML page, element is used to separate content in an HTML page. The <hr> tag is an empty tag, which means that it has no end tag. Note: You should try all the given code on your own for better understanding.

<p> This is first paragraph </p>
<p> This is second paragraph </p>
<hr>
<p> This is third paragraph </p>
<p> This is fourth paragraph </p>

Line Break in HTML using <br> tag

If you want to add a line break use
tag in HTML without starting a new paragraph. Refer the below code:

<p> This <br> is <br> paragraph </p>

Learn about Style attribute in HTML

The HTML style attribute is used to add styles to an element, such as color, font, size, and more. Setting the style of an HTML element, can be done with the style attribute. The property is a CSS property. The value is a CSS value. The HTML style attribute has the following syntax:

<tag-name style="property : value;">

Below are some of the commonly used properties:
style attribute for styling HTML elements
color for text colors
font-size for text sizes
background-color for background color
text-align for text alignment
font-family for text fonts

Text Formatting in HTML

HTML text formatting elements are used to bold, italic, subscript, superscript, etc. to your text. Below given are the HTML text formatting element:
<b> Bold text
<strong> Important text
<i> Italic text
<em> Emphasized text
<mark> Marked text
<small> Smaller text
<del> Deleted text
<ins> Inserted text
<sub> Subscript text
<sup> Superscript text
The above all the elements have closing tags as well.

<tag-name > Write Here ! </tag-name>

Comments in HTML

Comments are usually written to understand the code. Comments are always ignored and are not displayed in the browser, but they can help document your HTML source code.

<!-- This is a comment -- >

Quotations and Citations in HTML

Below given are Quotations and Citations Elements: <blockquote> element defines a section that is quoted from another source. <q> tag defines a short quotation <abbr> tag defines an abbreviation or an acronym, like "HTML", "CSS". <address> tag defines the contact information for the author of a document <cite> tag defines the title of a creative work(e.g. a poem, a book, a sculpture, etc.) <bdo> Bi-Directional Override is used to override the current text direction. Text will be written in reverse direction. I would recommend to try all the above tags on your own for better understanding.

This is the end of Part-2, I will be continuing after this in next part. Thank You !

More from this blog

Mahek

17 posts