HOW-TO

How to make a website in HTML

A small website is one HTML file plus a few lines of CSS. Build a one-page site step by step, check it on a phone-sized screen, add more pages if you need them, and put it online so anyone can open it.

6 min read·

Have the file already? Upload it and get a link anyone can open. Free plan, no card.

Get a link free

A website is a set of HTML files a browser can open. For a portfolio, a small business, an event or a project page, one file is enough to start. You need a text editor (Notepad on Windows, TextEdit on a Mac in plain-text mode, or a free code editor such as VS Code) and a browser. No software to install, no account, no build step.

1. Create the file

Make a new folder called my-site. Inside it, create a file called index.html. The name matters: hosts open index.html when someone visits the address with no file name. If you have not saved an HTML file before, create an HTML file covers the save settings that stop it turning into index.html.txt.

Paste this starter code and save:

<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Sam's Bakery</title> </head>

<body> <h1>Sam's Bakery</h1> <p>Fresh bread every morning from 7am.</p> </body> </html>

Double-click index.html and it opens in your browser. The title shows on the browser tab and in search results. The viewport line makes the page fit phone screens; without it, phones show a shrunken desktop view.

2. Add a header and sections

Most one-page sites have the same parts: a header with the name and links, a few sections, and a footer. Replace what is between <body> and </body> with these pieces, in order:

Header with the name and links: <header> <h1>Sam's Bakery</h1> <nav> <a href="#menu">Menu</a> <a href="#visit">Visit</a> <a href="#contact">Contact</a> </nav> </header>

One section per topic, inside <main>: <section id="menu"> <h2>Menu</h2> <ul> <li>Sourdough loaf</li> <li>Cinnamon buns</li> </ul> </section>

Opening hours and address: <section id="visit"> <h2>Visit</h2> <p>12 Market Street. Open Tuesday to Sunday, 7am to 2pm.</p> </section>

Contact: <section id="contact"> <h2>Contact</h2> <p><a href="mailto:hello@example.com">hello@example.com</a></p> </section>

Close </main>, then the footer: <footer> <p>&copy; 2026 Sam's Bakery</p> </footer>

The links in the nav jump to the section with the matching id, so href="#menu" scrolls to id="menu". Use one h1 for the site name and h2 for each section heading. The mailto link opens the visitor's email app with your address filled in. For more on each part, see make a navigation bar, make a list and make a footer.

3. Add an image

Put the photo in the my-site folder next to index.html, then add it where you want it:

<img src="shop.jpg" alt="The bakery counter" width="800" height="533">

The src must match the file name exactly, including capitals: Shop.JPG and shop.jpg are different files once the site is online. Keep images in the same folder, or a folder inside it such as images/shop.jpg, so the path still works after you upload. Resize big phone photos to about 1600 pixels wide before adding them; change image size in HTML shows how.

4. Style it with CSS

Add a <style> block inside the <head>, after the title, and put these rules between <style> and </style>. They are enough for a clean, readable site:

body { font-family: system-ui, sans-serif; line-height: 1.6; color: #222; margin: 0; }

header, main, footer { max-width: 760px; margin: 0 auto; padding: 24px 16px; }

nav a { margin-right: 16px; color: #b5541c; }

section { margin-bottom: 40px; }

img { max-width: 100%; height: auto; border-radius: 8px; }

footer { color: #777; font-size: 14px; }

max-width: 760px keeps lines short enough to read on a wide screen, and the 16px side padding stops text touching the edge on a phone. img { max-width: 100%; } shrinks photos to fit narrow screens. To change colors and fonts, see change text color, change background color and change font. When the CSS grows past a screen or so, move it to its own file: link CSS to HTML.

5. Check it on a phone-sized screen

Save, then refresh the browser. Drag the window narrow, or open the browser's developer tools (F12 on Windows, Cmd+Option+I on a Mac) and switch on the device toolbar to see a phone view. Look for text running off the side, images wider than the screen, and nav links that wrap onto two lines. Most fixes are one line: a fixed width somewhere that should be max-width.

6. Add more pages (optional)

For a second page, such as a full price list, create prices.html in the same folder with the same head and header, and link to it from the nav:

<a href="prices.html">Prices</a>

Link back with <a href="index.html">Home</a>. Use relative links like these, with no leading slash and no C:\ or /Users/ path, or they will break once the site is online. Copying the header into each page is fine for two or three pages. Beyond that, see build a multi-page site without a build step.

Common problems

  • ✓The page shows the code instead of a web page: the file saved as .txt or as rich text. Save it again as plain text with the .html extension.
  • ✓An image shows a broken icon: the src does not match the file name or folder. Check capitals and the extension (.jpg vs .jpeg).
  • ✓Style changes do nothing: the browser shows the cached copy. Save the file and press Ctrl+Shift+R (Cmd+Shift+R on a Mac).
  • ✓The page is tiny on a phone: the viewport meta tag is missing from the head.
  • ✓Special characters show as ’ or similar: add <meta charset="UTF-8"> as the first line in the head.

Using an AI tool to build it

Claude, ChatGPT and Gemini will write the whole site from a short brief: what it is for, the sections, your colors, and "a single HTML file with the CSS in a style tag". Ask for one file; it is easier to save and host than a project with a build step. Read through the result before publishing: replace placeholder text and example addresses, and check that every link goes where you expect.

Put the website online

The file works on your computer, but nobody else can open it until it is on a web server. With FileShare Pro you upload index.html and its images from the dashboard, copy the link and send it. It opens in any browser, the visitor needs no account, and you can upload a new version over the old one without changing the link. For several pages under one link, publish them together as a mini-site so links like prices.html keep working. Sign up free to put your first site online. For other options, see free HTML hosting.

Frequently asked

How do I make a simple website using HTML?

Create a folder, add a file called index.html, paste the starter HTML with a head and body, add your headings, text, images and links, then style it with a <style> block. Open the file in a browser to check it.

What program do I need to write HTML?

Any plain-text editor: Notepad on Windows, TextEdit on a Mac in plain-text mode, or a free code editor such as VS Code. You view the result in any web browser.

Can I make a website with only HTML?

Yes. HTML alone gives you text, images and links. Add a few lines of CSS for layout and colors. JavaScript is only needed for interactive parts.

How do I put my HTML website online?

Upload the HTML file and its images to a host. FileShare Pro gives you a link anyone can open; GitHub Pages, Netlify and Cloudflare Pages are other options.

Got a page to share?

Drop the file, copy the link — live in seconds, free plan included.

Start sharing free