<a href="https://www.EDUCBA.com">Link to EDUCBA website</a>
Images: Images () can provide visual content in a document.
Syntax:
<img src="image.jpg" alt="Image Description">
Code:
<!DOCTYPE html>
EDUCBA’s Page
Hello World! This is EDUCBA’s first web page.
Output:
How to Create an HTML Table?
There are specific table tags to create a table – mainly,
,
,
, and
.
Pre-requisites for HTML Table
For an absolute beginner, it is essential to know what the different table tags do before writing a basic code.
: Defines a table
: Defines a table row
: Defines a table header cell
: Defines a table data cell
Student Details Table
John has to create a webpage showing the names of students in a class along with their marks in mathematics and science. He draws the following table.
Name
Mathematics
Science
Mary
78
92
Susan
98
84
Amy
63
79
Now, John wants to write the code to transform this table into an HTML table on a webpage. The steps-
Step #1: Open an HTML code editor. This tutorial demonstrates how to write code in Visual Studio Code. If the PC doesn’t have VS Code, one can download it here.
Step #2: Select File > New Text File.
Step #3: Click on “Select a language” and then type HTML in the text box. Choose the HTML option to create a new HTML file.
Step #4: Again, go to File > Save As and save the file with the filename.html format.
Step #5: Add the basic code, i.e., HTML template of doctype declaration, HTML tag, head tag, title tag, and body tag, as shown below. Set the title as Student Details.
Code:
<!DOCTYPE html>
Student Details
Output:
Opening the file should show the following blank web page. Note the title in the browser tab has changed to “Student Details.”
Step #6: Now, define the table using the
tag inside the body tag. Define the first row using the
tag, and add 3 headings cells – Name, Mathematics, and Science, using the
tag. Don’t forget to close the tags with a corresponding closing tag.
To create web pages, provide the structure and content for displaying information in a web browser.
E-commerce
To create online stores, product catalogs, and shopping carts, allowing customers to purchase products and services online.
Landing pages
To develop compelling landing pages for websites that capture a visitor’s attention and encourage them to take a specific action.
Newsletters
It allows the creation of interactive and visually appealing newsletters, such as corporate newsletters, that deliver to subscribers via email.
Online portfolios
To create online portfolios for artists, photographers, and other creatives, showcasing their work and skills to potential clients and employers.
Blogs
One can create blogs, which are personal websites that provide a platform for writing and publishing articles and other content.
Documentation
It helps to create documentation and help files, providing information and guidance to users of the software and other products.
Advertisements
It can help make advertisements embedded on websites and social media platforms, promoting products and services to a wide audience.
Forms
To create a form, one can use
Advantages and Disadvantages
Pros
Cons
Open Standard: It is free of cost and readily available.
Limited Functionality: It cannot perform complex tasks like calculations or data storage.
Easy to Learn: HTML tags are basic and in a readable format, enclosed in angle brackets. It’s easy to learn and use, even for non-programmers.
Poor Security: It is vulnerable to security threats such as cross-site scripting (XSS) and SQL injection.
Search Engine Friendly: Search engines can easily crawl and index the content of the pages.
Inconsistent Browsers: Different browsers render HTML differently, leading to an inconsistent display of web pages on different browsers.
Community Support: It has large community support and many online resources available for learning and troubleshooting.
Poor Design Flexibility: It provides limited design options and creates static websites, making it difficult to create visually appealing dynamic websites without integrating CSS and JavaScript.
Final Thoughts
In conclusion, Hypertext Markup Language is a cornerstone of the World Wide Web. It provides a standardized way of defining the structure and content of a web page using a combination of tags and attributes. With HTML, one can create simple text-based web pages or complex, multimedia-rich applications. It is easy to learn and widely used, making it an essential skill for anyone interested in web development.
FAQs
Q1. How to convert an HTML to PDF?
Answer: To convert, use a library or online service that supports HTML to PDF conversion.
Q2. How to add an image in HTML?
Answer: To add an image, use the tag with the src attribute pointing to the image file’s URL or local path. Example:
<img src="image.jpg" alt="Alt text">
Q3. Is HTML a programming language? What is the HTML used for?
Answer: Hypertext Markup Language is not a programming language, it is a markup language used for creating web pages and other information displayed in a web browser. HTML defines the structure and content of a web page using a set of markup tags.
Q4. How to add a video in HTML?
Answer: To add a video, use the
<video src="video.mp4"></video>
One can also add controls to play, pause, and adjust volume with the controls attribute:
<video src="video.mp4" controls></video>
Q5. Is HTML case-sensitive?
Answer: No, elements are not case-sensitive. However, as best practice, it’s good to follow the same casing in all tags or elements to improve code readability.
Q6. How many tags are in HTML?
Answer: There are over 140 tags specified in the HTML5 standard, but some of them have become obsolete and are not widely used. Commonly used tags include headings, paragraphs, links, images, lists, tables, forms, and multimedia elements like audio and video.
Q7. What is HTML doctype?
Answer: The first line of a document is the doctype or document type declaration, which defines the version of the HTML used. Example:
<!DOCTYPE html>
Q8. What is an HTML header?
Answer: The HTML tag defines a header section in a document. This section typically contains information such as the page title, logo, and navigation menu. The header section is usually displayed at the top of the page, and its content is typically shared across multiple pages of a website. The header tag helps to define the structure and hierarchy of a web page and makes it easier to create a consistent look and feel across multiple pages.