Introduction to html
1. HTML Tags and Attributes
HTML (Hyper Text Markup Language) is the standard language for
creating web pages. It uses tags to define elements, and attributes
provide additional information about those elements.
Example of HTML Tags
• Headings: <h1> to <h6> for different levels of headings.
• Anchor (link): <a> for hyperlinks.
• Image: <img> for images (self-closing).
• Paragraph: <p> for paragraphs.
Example of HTML Attributes
Attributes are used to provide additional information about an HTML
element. They usually come in name/value pairs like name="value".
• href: Specifies the URL for links.
• src: Specifies the path to an image.
• class: Assigns one or more class names to an element for CSS
styling.
• id: Specifies a unique id for an element.
2. HTML Color Coding
HTML allows you to specify colors using various formats:
➢ Named Colors: Using color names like red, blue, etc.
<p style="color: red;">This is red text.</p>
➢ Hexadecimal: A six-digit code prefixed by #.
<p style="color: #ff0000;">This is red text.</p>
➢ RGB: Using the RGB color model.
<p style="color: rgb(255, 0, 0);">This is red text.</p>
3. <div> and <span> Tags for Grouping
o <div> Tag
The <div> tag is a block-level element used to group other
elements. It is often used for layout and styling purposes.
<div class="container">
<h1>Header</h1>
<p>This is a paragraph inside a div.</p>
</div>
o <span> Tag
The <span> tag is an inline element used to group inline elements.
It’s useful for applying styles to a small section of text within a
block.
<p>This is a <span style="color: blue;">blue</span> word in a
sentence.</p>