How to Build, Host, and Deploy Your First HTML Website
Follow this step-by-step guide to generate, preview, edit, and publish your lightweight HTML website using Gemini AI, GitHub Pages, and your own custom domain name.
Phase 1: Generating & Previewing Your Code
Step 1: Generate HTML Code with AI
- Find an example website you like for layout inspiration.
- Open Gemini AI and submit a prompt like this:
"I want to create a lightweight, fast-loading HTML landing page inspired by [Paste URL or describe layout]. Include a header, hero section, features list, image placeholders, contact form, and footer. Output everything in a single, self-contained HTML file with embedded CSS styling."
- Copy the generated code block from Gemini.
Step 2: Create a Local Preview File
- Open Notepad (Windows) or TextEdit (Mac, set to Plain Text mode via
Format -> Make Plain Text). - Paste the code generated by Gemini into the editor.
- Save the file as:
index.html
- Note for Windows: In Notepad, change "Save as type" to All Files (.) so it does not save as
index.html.txt.
- Note for Windows: In Notepad, change "Save as type" to All Files (.) so it does not save as
- Double-click
index.htmlto open and view the live preview in your web browser.
Phase 2: Adding Images & Local Files
Step 3: Organize Your Folder
- Create a folder on your computer named
my-website. - Move
index.htmlinto this folder. - Place all custom images (logos, banners) into this same folder.
- Keep image filenames short and lowercase using hyphens (e.g.,
logo.png,hero-banner.jpg).
Step 4: Link Images in Your Code
In index.html, locate the tags and update the src attribute to match your exact file name:
CRITICAL RULE: Before making major code changes, open Log in to your domain registrar (GoDaddy, Namecheap, Cloudflare) and add these records in DNS Management: (DNS updates take anywhere from 15 minutes to 24 hours to propagate full network-wide).
Phase 3: Publishing Free on GitHub Pages
Step 5: Set Up a GitHub Repository
my-landing-page).Step 6: Upload Your Files
index.html and all your image files into the upload zone.Step 7: Turn On GitHub Pages
main (or master).[https://yourusername.github.io/my-landing-page](https://yourusername.github.io/my-landing-page)).Phase 4: Editing Code & Making Safe Backups
index.html, copy the entire code block, and save it in Notepad as a local backup file (e.g., backup-index-date.html). If an edit breaks your site, you can restore your backup instantly.Making Direct Edits in GitHub
index.html inside your GitHub repository.Phase 5: Connecting a Custom Domain
Step 8: Configure Custom Domain in GitHub
[www.yourdomain.com](https://www.yourdomain.com)), and click Save.Step 9: Update Your Domain DNS Settings
Apex Domain (
yourdomain.com) — Four A Records:@ | IP Address: 185.199.108.153@ | IP Address: 185.199.109.153@ | IP Address: 185.199.110.153@ | IP Address: 185.199.111.153Subdomain (
[www.yourdomain.com](https://www.yourdomain.com)) — CNAME Record:www | Target / Value: yourusername.github.io