HTML Basic

Here are some basic concepts in HTML:


1. HTML Document Structure: An HTML document starts with a doctype declaration (`<!DOCTYPE html>`), followed by the `<html>` element that wraps the entire document. The document is divided into two main sections: the `<head>` and the `<body>`.


2. Head Section: The `<head>` section contains meta-information about the document, such as the page title (`<title>`), character encoding (`<meta charset="UTF-8">`), CSS stylesheets (`<link rel="stylesheet" href="styles.css">`), or JavaScript files (`<script src="script.js"></script>`).


3. Body Section: The `<body>` section contains the visible content of the webpage. It consists of various HTML elements that define the structure and layout of the page, such as headings (`<h1>`, `<h2>`, etc.), paragraphs (`<p>`), images (`<img>`), links (`<a>`), lists (`<ul>`, `<ol>`, `<li>`), tables (`<table>`, `<tr>`, `<td>`), forms (`<form>`, `<input>`, `<button>`), and more.


4. HTML Elements: HTML elements are represented by tags. They define different parts of a webpage and are enclosed in angle brackets (`<` and `>`). Most elements have an opening tag and a closing tag, with the content placed between them. For example, `<p>Hello, World!</p>` defines a paragraph element with the text "Hello, World!".


5. Attributes: HTML elements can have attributes that provide additional information about the element. Attributes are specified within the opening tag and consist of a name-value pair. For example, `<img src="image.jpg" alt="Description of the image">` uses the `src` attribute to specify the image source file and the `alt` attribute to provide an alternative text for screen readers.


6. Nesting and Hierarchy: HTML elements can be nested inside other elements, creating a ierarchical structure. For example:


html
<div>
<h1>Heading</h1>
<p>Paragraph</p>
</div>

Here, the `<h1>` and `<p>` elements are nested within the `<div>` element.


7. Semantic HTML: HTML5 introduced semantic elements that give meaning to the structure of a webpage. These elements, such as `<header>`, `<nav>`, `<section>`, `<article>`, `<footer>`, etc., help search engines and assistive technologies better understand the content and improve accessibility.


8. Comments: HTML allows you to add comments within your code to provide explanations or make notes. Comments are ignored by browsers and are enclosed between `<!--` and `-- >`.


Here's a simple example of an HTML document:
html
<!DOCTYPE html>
<html>
<head>
    <title>My Webpage</title>
    <link rel="stylesheet" href="styles.css">
</head>
<body>
    <h1>Welcome to My Webpage</h1>
    <p>This is a paragraph of text.</p>
    <img src="image.jpg" alt="Description of the image">
    <a href="https://example.com">Visit Example.com</a>
</body>
</html>

This basic HTML structure forms the foundation for creating webpages. By combining various HTML elements and attributes, you can create rich and interactive content for the web.



About the Author



Silan Software is one of the India's leading provider of offline & online training for Java, Python, AI (Machine Learning, Deep Learning), Data Science, Software Development & many more emerging Technologies.

We provide Academic Training || Industrial Training || Corporate Training || Internship || Java || Python || AI using Python || Data Science etc





 PreviousNext