How to write "Hello World" in HTML

Key takeaways

  • HTML is the backbone of web pages. It defines the content structure and layout, ensuring that everything from text to images is properly displayed.

  • Writing "Hello World" teaches the basic syntax and structure of HTML. Understanding how to use <html>, <head>, and <body> tags is critical for building more complex pages.

  • HTML offers tags like <b> and <p> for formatting and <h1> to <h6> for headings. These elements not only structure the page visually but also contribute to search engine optimization (SEO).

  • HTML code runs in all modern browsers without compilation. This simplicity makes it easy to experiment with web page changes in real time—write code, save, and refresh the browser to view updates instantly.

The first step to getting familiar with a new language is to write a simple "Hello World" program, and the same goes for HTML (Hypertext Markup Language). HTML is widely used to design the structure of web pages. It serves as the foundation for web development, allowing developers to define layouts and present content effectively.

Hello World in HTML
Hello World in HTML

Want to build a real-world application with HTML? Try this project, "Build a Microblogging App Using PHP, HTML, JavaScript, and CSS."

We will look at multiple examples to learn how to write "Hello World" in HTML web pages. Let’s go over each one in detail.

Code example 1: Basic HTML structure

In the example below, we demonstrate how to display text with various HTML tags. The <b> tag makes text bold, and the <p> tag adds paragraph spacing, showing how content formatting can be controlled in HTML.

Enhance you understanding of HTML and its related concepts with the help of this project, "Creating an Online CV with HTML and CSS."

Code example 2: "Hello World" in different sizes

HTML offers several heading tags from <h1> (largest) to <h6> (smallest). These tags not only structure content visually but also help search engines understand your page’s organization.

This structure introduces you to the concept of hierarchy, an essential part of HTML that aids in both visual design and SEO.

Frequently asked questions

Haven’t found what you were looking for? Contact Us


How do I view my HTML file in a web browser?

After saving the file with a .html extension, double-click it or use “Open With” to select your browser. The file will open in the browser and will render the content and UI without compilation.


Can I use CSS to style my "Hello World" page?

Yes, you can use CSS to style your HTML pages. CSS allows you to enhance your HTML page visually. You can embed CSS styles directly within <style> tags in the <head> section, or use external stylesheets to manage your page’s layout.


What are the essential tags for building an HTML document?

The key tags include <html> to wrap the whole document, <head> for metadata and styles, and <body> for visible content.


Free Resources

Copyright ©2024 Educative, Inc. All rights reserved