Table of contents
No headings in the article.
“Any fool can write code that a computer can understand. Good programmers write code that humans can understand.” – Martin Fowler
Hii readers. Today I will share some HTML tags along with their attributes. So what are you waiting for? Let's start coding👩💻
Heading tags
HTML has six "levels" of headings:<h1>
is used for main headings.
<h2>
is used for subheadings.
If there are further sections
under the subheadings then the <h3>
element is used, and so on...
Browsers display the contents of headings at different sizes. The
contents of an <h1>
element is
the largest, and the contents of
an <h6>
element is the smallest.
Paragraph tag
To create a paragraph, surround the words that make up the paragraph with an opening<p>
tag and closing </p>
tag.
By default, a browser will show each paragraph on a new line with some space between it and any subsequent paragraphs.
The <p>
tag specifically supports the alignment attribute and allows us to align our paragraphs in left, right, or center alignment.
Bold and italics
By enclosing words in the tags<b>
and </b>
we can make
characters appear bold.
The <b>
element also represents
a section of text that would be
presented in a visually different
way (for example key words in a
paragraph) although the use of
the <b>
element does not imply
any additional meaning.
By enclosing words in the tags
<i>
and </i>
we can make
characters appear italic.
The <i>
element also represents
a section of text that would be
said in a different way from
surrounding content — such as
technical terms, names of ships,
foreign words, thoughts, or other
terms that would usually be
italicized.
Subscript and Superscript
The <sup>
element is used
to contain characters that
should be superscript such
as the suffixes of dates or
mathematical concepts like
raising a number to a power such as 2².
The <sub>
element is used to contain characters that should be subscript. It is commonly used with foot notes or chemical
formulas.
White space
In order to make code easier to read, web page authors often add extra spaces or start some elements on new lines.
When the browser comes across two or more spaces next to each other, it only displays one space. Similarly if it comes across a line break, it treats that as a single space too. This is known as white space collapsing.
You will often see that web page authors take advantage of white space collapsing to indent their code in order to make it easier to follow.
Line breaks
The browser will automatically show
each new paragraph or heading on a new line. But if you want to add a line break inside the middle of a paragraph you can use the line break tag <br>
.
Horizontal rule
To create a break between themes — such as a change of
topic in a book or a new scene
in a play — you can add a
horizontal rule between sections
using the <hr>
tag.
There are a few elements that do not have any words between an opening and closing tag. They are known as empty elements and they are written differently and mostly have only one tag i.e. opening tag.
It has the following attributes:
• align It is used to specify the alignment of the horizontal rule. It accepts values- left, right,center.
•size It is used to specify the height of the horizontal rule.
•width It is used to specify the width of the horizontal rule.
•color It is used to specify the color of the horizontal rule.
•noshade It is used to specify the bar without any shading effect.
Thanks for reading this till end. I hope you found this blog useful. Don't forget to follow me to recieve more of this in future.
Any suggestions are welcome in the comments. Looking forward to your response.
Keep learning📚
Keep coding👩💻🚀
Lots of love❤️