HTML Basics
HTML (HyperText Markup Language) is the standard markup language used to create web pages. It structures content on the web and enables browsers to display text, images, links, and other media.1. Structure of an HTML Document :-
An HTML document is structured with various elements, each represented by tags. The basic structure includes:
‣
: Declares the document type.
‣
: Root element of the HTML document.
‣
: Contains meta-information, title, and links to scripts and styles.
‣
: Sets the title of the document shown in the browser tab.
‣
: Contains the content of the web page.
2. Common HTML Elements :-
‣ Headings: to represent headings, with being the largest and the smallest.
‣ Paragraphs: defines a paragraph.
‣ Links: creates hyperlinks.
‣ Images: embeds images.
‣ Lists:
(1.) Ordered Lists:
(2.) Unordered Lists:
3. Attributes :-
HTML elements can have attributes that provide additional information. Common attributes include:
‣ id: A unique identifier for the element.
‣ class: Classifies elements for styling.
‣ style: Inline CSS styles.
‣ src: Source for images or scripts.
Example :-
4. Semantic HTML :-
Semantic HTML uses tags that convey meaning about the content. For example:
‣
: Defines the header section.
‣
: Contains navigation links.
‣
: Represents a self-contained composition.
‣
: Defines the footer of a section or page.
5. Comments :-
Comments can be added for code clarity, using the syntax:
6. HTML Best Practices :-
‣ Use semantic tags for better accessibility and SEO.
‣ Keep the HTML well-structured and indented for readability.
‣ Validate HTML to ensure it meets standards.
Understanding the basics of HTML is essential for anyone looking to create web content. Familiarity with its structure and elements will enable you to build more complex and interactive web pages as you advance.