
HTML, or HyperText Markup Language, is the foundation of every web page on the internet. Whether you eventually build with a modern framework or a content management system, everything a browser displays starts as HTML. Learning to write it by hand gives you a deeper understanding of how websites work, helps you troubleshoot layout issues, and makes you a more capable designer or developer. In this guide you will create an HTML code for a web page step by step, from the basic document skeleton to semantic structure, media, and forms.
Get Professional Support from AAMAX.CO
Writing your first HTML page is an excellent learning experience, but a business website demands clean, accessible, and search-friendly code at scale. AAMAX.CO is a full service digital marketing company that offers web development, digital marketing, and SEO services worldwide. Their developers write standards-compliant HTML that loads quickly, works across browsers, and gives search engines a clear picture of each page. If you would rather focus on running your business, they can turn your ideas into a polished, high-performing website built on a solid code foundation.
What You Need to Get Started
You do not need expensive software to write HTML. A plain text editor works, though a code editor such as Visual Studio Code, Sublime Text, or Notepad++ makes life easier with syntax highlighting and auto-completion. You also need a web browser to preview your work. Create a folder for your project and save a new file named index.html.
Step 1: Write the Basic Document Structure
Every HTML page follows a standard skeleton. Type the following into your file:
<!DOCTYPE html><html lang="en"><head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>My First Web Page</title> <meta name="description" content="A simple page built with HTML."></head><body></body></html>The DOCTYPE tells the browser to use modern standards. The html element wraps everything, and the lang attribute helps screen readers and search engines. The head contains metadata such as the character set, viewport settings for mobile devices, the page title shown in browser tabs, and a meta description for search results. Visible content goes inside the body.
Step 2: Add Headings and Paragraphs
Headings range from h1 to h6 and create a content hierarchy. Use one h1 per page for the main topic, then h2 and h3 for sections and subsections. Paragraphs use the p tag:
<h1>Welcome to My Website</h1><p>This page shares my ideas, projects, and services.</p><h2>About Me</h2><p>I love building things for the web.</p>A logical heading structure improves readability, accessibility, and SEO.
Step 3: Insert Links and Images
Links connect pages together using the anchor tag, while images use the self-closing img tag:
<a href="about.html">Learn more about me</a><img src="images/photo.jpg" alt="Portrait of the site owner" width="600" height="400">Always include descriptive alt text so visually impaired users and search engines understand the image. Setting width and height prevents layout shifts while the page loads.
Step 4: Organize Content with Lists
Use unordered lists for bullet points and ordered lists for steps:
<ul> <li>Web design</li> <li>Development</li></ul><ol> <li>Plan</li> <li>Build</li></ol>Step 5: Use Semantic Layout Elements
Semantic HTML5 elements describe the purpose of each area of the page, which helps assistive technology and search engines:
headerfor the logo and introductory content.navfor the main navigation menu.mainfor the primary content of the page.sectionandarticlefor grouped or standalone content.asidefor related sidebars.footerfor copyright, contact details, and secondary links.
Replacing generic div elements with these tags makes your code easier to read and maintain.
Step 6: Add a Simple Contact Form
Forms collect information from visitors. Always pair inputs with labels:
<form action="/contact" method="post"> <label for="name">Name</label> <input id="name" name="name" type="text" required> <label for="email">Email</label> <input id="email" name="email" type="email" required> <button type="submit">Send</button></form>The required attribute and input types like email provide built-in validation without extra code.
Step 7: Connect CSS for Styling
HTML defines structure; CSS controls appearance. Create a file named styles.css and link it inside the head with <link rel="stylesheet" href="styles.css">. Keeping styles in a separate file makes your design consistent across pages. Thoughtful website design transforms plain markup into a branded, engaging experience.
Step 8: Preview, Validate, and Publish
Open index.html in your browser to preview your page. Run your code through the W3C Markup Validation Service to catch unclosed tags or invalid attributes. When you are happy with the result, upload your files to a hosting service or static site platform to make the page public.
HTML Best Practices
- Indent nested elements consistently for readability.
- Use lowercase tag and attribute names.
- Keep content, styling, and scripts in separate files.
- Write meaningful titles and meta descriptions for every page.
- Test with keyboard navigation and a screen reader.
As your project grows into multiple templates, dynamic content, and integrations, professional website development keeps your codebase organized and scalable.
Conclusion
Creating an HTML code for a web page is the first and most important step in web development. By mastering the document structure, headings, text, links, images, lists, semantic elements, and forms, you gain the skills to build clean and accessible pages. Practice by creating a few small pages, validate your code, and gradually add CSS and JavaScript. With a strong HTML foundation, every other web technology becomes easier to learn.