Skip to content
the poor coder

write "hello world"

Poor Man
Published
Reading time
1 min read
On this page

Writing "Hello World" in HTML#

If you are new to programming, writing "Hello World" is usually the first step to getting started. It's a simple program that displays the text "Hello World" on the screen. Here is how you can write it in HTML:

Method 1:#

Text

      <html>
        <head>
          <title>Hello World</title>
        </head>
        <body>
          <p>Hello World</p>
        </body>
      </html>
    

This code will display the text "Hello World" in a paragraph element within the body of an HTML document. The title element within the head section is optional but recommended for accessibility purposes.

Method 2:#

Text

      <html>
        <head>
          <title>Hello World</title>
        </head>
        <body>
          Hello World
        </body>
      </html>
    

This code will display the text "Hello World" directly within the body of an HTML document without using any tags. However, it is generally recommended to always use tags in HTML for accessibility and semantic reasons.

Method 3:#

Text

      <!DOCTYPE html>
      <html>
        <head>
          <title>Hello World</title>
          <meta charset="UTF-8">
          <meta name="viewport" content="width=device-width, initial-scale=1.0">
        </head>
        <body>
          <h1>Hello World</h1>
        </body>
      </html>
    

This code is similar to method 1, but includes a DOCTYPE declaration and additional meta tags for better performance and compatibility with different devices. It also uses a heading tag instead of a paragraph tag to display the text "Hello World".

Overall, these are just a few ways to write "Hello World" in HTML. Depending on your project or personal preference, you may choose to write it differently. However, as long as the code is valid and accessible, you should be good to go!

Keep going

2023

how to sort an array

How to Sort an Array If you have an array and you want to order its elements in a specific way, you need to use a sorting algorithm. There are several sorting algorithms available, but two of the most commonly used are…

javascript2 min read
2023

jquery mobile or desktop

jQuery Mobile or Desktop? As a web developer, I have had some experience with both jQuery Mobile and jQuery Desktop. Both frameworks have their pros and cons, and which one to use really depends on the specific project…

javascript1 min read
2023

node.js folder structure

Node.js Folder Structure If you are new to Node.js, it can be daunting to create a folder structure that will work for your project. The structure you choose will depend on the size and complexity of your project. Here…

javascript1 min read
ESC