HTML Notes
HTML Notes
HTML (HyperText Markup Language) is the standard language used to create and design webpages. It provides
the basic structure of websites and web applications, consisting of various elements and tags to define content,
structure, and layout.
1. Structure of HTML
2. HTML Tags
• Tags are enclosed in angle brackets (< >), and most tags come in pairs (opening and closing tags), like:
o <p> and </p> for paragraphs.
o <h1> to <h6> for headings (from most important <h1> to least important <h6>).
o <a> and </a> for hyperlinks.
o <img> for images (self-closing tag).
o <ul> and <ol> for unordered and ordered lists, respectively.
3. Attributes
• HTML tags can have attributes that provide additional information about an element. Common attributes
include:
o id: A unique identifier for an element.
o class: Used to group elements for styling with CSS.
o href: Defines the URL in anchor (<a>) tags for hyperlinks.
o src: Defines the source URL for images in <img> tags.
o alt: Provides alternative text for images if the image cannot be displayed.
• Text Elements:
o <h1>, <h2>, <h3>, ... <h6>: Headings
o <p>: Paragraph
o <b>: Bold text
o <i>: Italic text
o <br>: Line break
o <strong>: Strong importance (usually bold)
o <em>: Emphasized text (usually italic)
o <u>: Underlined text
• List Elements:
o <ul>: Unordered (bulleted) list
o <ol>: Ordered (numbered) list
o <li>: List item (used inside <ul> or <ol>)
• Table Elements:
o <table>: Defines a table
o <tr>: Table row
o <td>: Table data (cell)
o <th>: Table header
• Forms and Input Elements:
o <form>: Container for form elements
o <input>: Input fields for text, buttons, checkboxes, etc.
o <textarea>: Multi-line text input
o <button>: Button element
o <select>: Dropdown list
o <label>: Label for input fields
6. Forms in HTML
8. HTML Comments
• Comments in HTML are used for documentation and are ignored by browsers:
• <!-- This is a comment -->
9. HTML Entities
• HTML entities represent special characters that cannot be typed directly in HTML, such as:
o < for < (less than)
o > for > (greater than)
o & for & (ampersand)
o " for " (double quote)
• It is essential to ensure that HTML is properly structured for accessibility, compatibility, and SEO.
HTML validators check for syntax errors and enforce standards.
• Proper use of semantic HTML helps improve the accessibility of websites. It makes the content more
understandable and navigable for people with disabilities, such as those using screen readers.
Conclusion:
HTML is the backbone of web development, providing the basic framework for web pages. While it is often
used alongside CSS (for styling) and JavaScript (for interactivity), HTML remains central to defining the
structure and content of websites. Understanding HTML's tags, attributes, and best practices is crucial for
anyone working in web development.