Getting Started with HTML: A Beginner's Guide
HTML (HyperText Markup Language) is the foundation of any website. It is a markup language used to create web pages and applications that can be viewed on the Internet. In this beginner's guide, we will walk you through the basics of HTML and help you get started with your first website.
HTML Tags
HTML consists of a series of tags that define the structure and content of a web page. A tag is a keyword enclosed in angle brackets, such as <html>, <head>, <title>, <body>, etc. Tags are used to create headings, paragraphs, links, images, lists, and other elements of a web page.
Structure of an HTML Document
An HTML document has a basic structure that consists of two main parts: the head and the body. The head contains information about the document, such as the title, keywords, and stylesheets. The body contains the content of the document, such as text, images, and other elements.
<!DOCTYPE html> <html> <head> <title>My First Web Page</title> </head> <body> <h1>Welcome to My First Web Page</h1> <p>This is my first paragraph.</p> <img src="image.jpg" alt="My Image"> </body> </html>
The <!DOCTYPE html> declaration tells the browser that this document is an HTML5 document. The <html> tag defines the root element of the HTML document. The <head> tag contains the document metadata, and the <title> tag specifies the title of the document. The <body> tag contains the visible content of the document.
Adding Content
HTML allows you to add different types of content to your web page, such as text, images, videos, and links. Here are some examples of how to add content using HTML tags:
Text:
<p>This is a paragraph.</p>
Image: <img src="image.jpg" alt="My Image">
Video: <video src="video.mp4" controls></video>
Link: <a href="https://www.example.com/">Example</a>
Styling with CSS
CSS (Cascading Style Sheets) is used to style and layout web pages. It allows you to change the font, colour, size, and position of HTML elements. CSS is written in a separate file or in the head section of the HTML document.
<head> <title>My First Web Page</title> <style> h1 { color: red; font-size: 36px; } </style> </head>
The <style> tag is used to define the CSS rules. In this example, we are changing the colour and font size of the <h1> tag.
Conclusion
HTML is the foundation of web development and a necessary skill for anyone interested in creating web pages and applications. In this beginner's guide, we covered the basics of HTML, including tags, the structure of an HTML document, adding content, and styling with CSS. With this knowledge, you can start creating your own web pages and continue to explore the endless possibilities of web development.
Subscribe to my newsletter
Read articles from R N Raj directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by