Designing a homepage in HTML is two intertwined jobs: deciding what the page must communicate, then expressing those decisions in clean, semantic markup that browsers, search engines, and assistive technology can all understand. The core workflow is requirements first, structure second, styling third, and testing throughout. If you are building your very first page, you can have a credible homepage working in an afternoon; polishing it well enough to publish usually takes a few focused passes, because most of the effort sits in content hierarchy, responsive behavior, and accessibility rather than in typing tags.
This guide walks through a complete build using only HTML and CSS, with a few lines of optional JavaScript at the end. It targets current evergreen browsers as of late 2026, assumes no framework, and treats your homepage as the single entry point of a small site. Every step includes what to expect and how to confirm it worked.
Start with the homepage's job description, not the code
A homepage has one structural peculiarity: it must serve visitors who arrive from search engines looking for something specific, and visitors who land there cold and need orientation. That dual role drives everything else. Before writing markup, write a short brief in plain language covering four points.
First, the single primary action you want a visitor to take: read a featured article, request a quote, browse a catalog, or contact you. Second, the two or three secondary destinations that deserve prominent links. Third, the identity signals: who you are, what you do, and where you operate. Fourth, the content you actually have ready to publish. That last point matters more than enthusiasm suggests, because a homepage wireframe drawn around hero photography and testimonials collapses if you have neither.
A concrete example: a one-person bicycle repair workshop might decide its primary action is "book a repair slot," its secondary links are services and pricing, its identity line is the workshop name plus neighborhood, and its available content is a phone number, an address, a price list, and three photos. That brief translates almost mechanically into the section order below. Skipping the brief is the most common reason first homepages feel like a pile of widgets rather than a page.
Set up the project before writing markup
Create a folder for the site and, inside it, a subfolder for assets. A workable starting structure looks like this: an index.html file at the top level, an images folder, a styles.css file, and optionally a scripts.js file. The homepage file must be named index.html because that is the default document most web servers and static hosts return when a visitor requests the folder's address.
At the top of index.html, place a document type declaration and the basic skeleton before anything else. The first line should be , which tells the browser to use modern standards mode; omitting it can trigger legacy rendering quirks. Follow it with an html element carrying lang="en" or the appropriate language tag for your content, because screen readers use that attribute to choose pronunciation rules. Inside, a head element holds metadata that is not displayed, and a body element holds everything that is.
Two setup details save trouble later. Serve the page through a local development server rather than double-clicking the file, because opening a file directly uses the file:// protocol and some browser features behave differently than under . Most code editors include a live-preview server; Python's built-in python -m http.server in the project folder is an alternative. Also decide the character encoding now: save files as UTF-8 and declare as the first element inside head, so accented characters and symbols render correctly.
Build the document head: title, description, icons, viewport
The head is invisible but shapes how the page appears in search results, browser tabs, and social previews. Six items belong there for a typical homepage.
The element supplies the browser tab label and the clickable headline in search results. Write it as a specific phrase combining the page's purpose and the organization's name, roughly under 60 characters so it is not truncated in common result displays. "Bicycle Repair in [Neighborhood] — [Workshop Name]" communicates more than "Home."
The meta description, , is a one- or two-sentence summary that search engines may display as the snippet beneath the title. It does not directly change rankings in any documented way, but a clear description improves click-through and gives link previews something better than scraped text. Keep it honest and specific; around 150 to 160 characters is a common practical ceiling before truncation varies by device.
The viewport meta tag, , is essential for mobile rendering. Without it, phones assume a desktop-width canvas and shrink the whole page, producing the tiny-text effect familiar from older sites. With it, the layout width matches the device and your CSS media queries work as intended.
For the tab icon, add . Browsers tolerate its absence, but a missing icon looks unfinished. Social preview tags (og:title, og:description, og:image) are optional for a personal page and worthwhile if the homepage will be shared in messaging apps or social feeds; they reuse the same title and description content, so keep them consistent to avoid conflicting previews.
Finally, link the stylesheet with . Placing this link in the head rather than at the end of the body avoids a flash of unstyled content on slower connections.
Check success by loading the page: the tab should show your title, the favicon should appear, and resizing the browser window to a narrow width should not trigger the shrunken-desktop effect.
Lay out the semantic skeleton in a sensible order
Now write the visible structure with semantic elements that describe what each region is, not what it looks like. The browser's default appearance will be plain, and that is expected at this stage.
The sequence that works for most homepages runs: a header containing the site name and primary navigation; a main element wrapping all page-unique content; inside it, a hero or introduction section, then sections for offerings, proof, and the primary call to action; and finally a footer with contact details, legal or location information, and secondary links.
Here is a minimal skeleton to adapt, with placeholder content:
Several conventions in that snippet are deliberate. The page has exactly one h1, conveying the page's primary topic; section titles are h2. Heading levels descend without skipping, which keeps the document outline coherent for screen-reader navigation. Navigation sits inside a nav element with an accessible label so users who jump between landmarks can distinguish it from other link groups. The main element appears once and wraps only content unique to this page, while the header and footer repeat site-wide. The aria-labelledby attributes tie each section to its visible heading, giving assistive technology a reliable section name without duplicating text.
The choice of one h1 per page is a convention rather than an absolute rule of the HTML specification, which permits multiple; the practical reason to hold to one is that it makes the outline unambiguous. Headings should never be chosen for their font size. If a subheading looks too large, that is a styling problem solved with CSS.
A useful self-check: with CSS disabled entirely, the page should still read in a logical order and remain fully navigable. That is the simplest test of whether the structure, rather than the styling, is carrying the meaning. Another check uses the browser's accessibility inspector, available in the developer tools of major browsers, which lists landmarks and headings so you can verify that the outline matches your intent.
Plan the homepage content sections around visitor questions
The skeleton above is generic; the content inside it should answer the questions a visitor arrives with. A reliable homepage pattern moves from identity to specifics to proof to action, in that order, because cold visitors need orientation before detail and returning visitors can scroll past what they already know.
Identity and value in the hero. The first screen should state what the site is, for whom, and where. An h1 of "Bicycle repair in the neighborhood" plus a short paragraph and a primary link accomplishes this in under a minute of reading. Resist the urge to fill the hero with a carousel of rotating promotions; rotating banners frequently bury the primary message behind slides most visitors never see, and they complicate keyboard and screen-reader navigation.
Offerings. A section listing two to four services, each with a heading, a sentence of explanation, and a link to a detail page. Three items is a natural fit for the grid layouts described later and matches how people scan.
Proof. Reviews, a sample of work, credentials, or plain statements of experience. If you have no testimonials yet, a factual line such as years in operation or a description of typical jobs is better than invented praise. Fabricated reviews are both dishonest and, in many jurisdictions, unlawful under consumer-protection rules.
Primary action. A dedicated section restating the call to action, placed before the footer, catches visitors who read to the bottom before deciding.
Footer. Contact details, address, opening hours, and links to privacy or legal pages if your site collects data. This is the block visitors hunt for when they want a phone number.
Map each section back to the brief from step one. If a section does not serve the primary action, a secondary destination, an identity signal, or available content, cut it. A homepage with four well-made sections outperforms one with ten half-populated ones.
Mark up a hero and call to action that survives without CSS
Once the section plan exists, write each section's markup before any styling, verifying readability with CSS switched off. The hero typically pairs a single h1, a short paragraph, and one link that functions as the primary action. Make that link an a element with href pointing at the real destination; a link styled as a button beats a button element styled as one, because a button in raw HTML does nothing without JavaScript and defeats middle-click, copy-link, and open-in-new-tab behaviors.
Calls to action should carry specific text. "Book a repair slot" tells the visitor what happens next; "Learn more" and "Click here" do not, and screen-reader users sometimes navigate by link text alone, hearing a list of "Learn more" entries with no way to tell them apart. Where a visual design requires generic link text, the difference can be conveyed with hidden text inside the link, but simply writing specific labels solves the problem at no cost.
Images belong to this step too. Every img needs an alt attribute. For a meaningful photo, describe its content and purpose briefly: alt="Mechanic truing a wheel in the workshop". For purely decorative images, use alt="" so assistive technology skips them. Declare width and height attributes matching the image's intrinsic dimensions so the browser can reserve space and avoid layout shift as images load.
For a logo or site name in the header, wrap the text or image in an a element pointing at the homepage itself, which matches how visitors expect to return to the start from any inner page.
Verify this stage by disabling CSS in the browser's developer tools. The page should show its heading first, then introduction, then actions, with links working. If it reads coherently, the structure is sound.
Style the page with a mobile-first CSS baseline
Open styles.css and start with the small-screen case. The viewport tag has already made the layout width equal the device width, so the browser will honor your CSS at phone-sized dimensions. A baseline that produces a respectable result with minimal rules includes four moves.
First, fix the box model. *, *::before, *::after { box-sizing: border-box; } makes declared widths include padding and borders, eliminating a class of overflow bugs. Second, set a readable base type size and line height on the body, for example font-size: 1rem; line-height: 1.5;, with a system font stack such as system-ui, sans-serif for fast rendering without webfont downloads. Third, constrain text measure by giving main a max-width around 65 to 75 characters' worth of width, commonly implemented as max-width: 70ch or an equivalent pixel value, and centering it with margin-inline: auto. Lines much longer than that tire the eye. Fourth, set images to scale: img { max-width: 100%; height: auto; } prevents images overflowing narrow screens while preserving aspect ratio.
For the header and navigation, a common small-screen pattern is a simple stacked list of links, since horizontal space is scarce. A typical rule set removes list bullets (list-style: none), zeroes the default padding, and lets the nav list wrap. Getting the header to look right on a phone first, then enhancing it for wider screens, is the definition of mobile-first.
A neutral palette keeps the first version calm: one background color, one text color, one accent for links and buttons. Contrast between text and background should meet accessibility guidance—roughly a 4.5:1 ratio for normal-size body text—which is checkable with contrast tools in browser developer tools and with standalone contrast calculators.
Add responsive layout with flexbox and grid, plus media queries
Wider screens benefit from arrangement, and modern CSS handles it without a framework. Use flexbox for one-dimensional rows such as the header, where site name and navigation sit at opposite ends: a rule like header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; } typically suffices. Use grid for the services section, where equal cards should sit side by side above a certain width.
A particularly robust grid pattern avoids media queries entirely for the card layout: display: grid; grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr)); gap: 1.5rem;. This instructs the browser to fit as many columns of at least 16rem as the container allows and stretch them to fill the row, so the cards reflow from one column on a phone to three on a laptop with no breakpoint code. That is the behavior to expect, and it is easy to verify by dragging the browser window narrower and wider.
Media queries remain useful for changes that auto-fit cannot express, such as switching navigation from a stacked list to a horizontal row, adjusting spacing, or changing a hero from single column to two columns beside an image. The syntax is @media (min-width: 48rem) { ... }, containing the rules that apply at and above that width. Choosing breakpoints from your content—adding one when the layout starts to look cramped, not at device-specific pixel numbers—keeps the stylesheet honest.
Tables created with grid or flex still need their source order to make sense, because visual rearrangement in CSS does not change the reading order for assistive technology. Keep the DOM order logical and use CSS only to place things.
Check success at three widths: a narrow phone in your browser's device emulation mode, a tablet width, and a full desktop window. At each width, nothing should overflow horizontally, and the browser should never show a horizontal scrollbar caused by content.
Make the homepage accessible and keyboard-operable
Accessibility work is mostly already done if the earlier steps were followed, because semantic elements, headings, alt text, and labels do the heavy lifting. The remaining checks concern interaction.
Every interactive element must be reachable by Tab and operable by keyboard alone. Plain a elements pass this test automatically; custom clickable div elements do not, which is one more reason to use real links and buttons. When something is focused via keyboard, it must be visibly focused. Browsers draw a default focus ring; if a stylesheet removes it with outline: none, focus becomes invisible and keyboard navigation effectively breaks. If the default ring clashes with the design, replace it with a visible custom style using :focus-visible, for example a two-pixel outline in the accent color.
Navigation should have a way to skip directly to main content for keyboard and screen-reader users who otherwise tab through every header link on every page. A one-link implementation places Skip to content as the first element in the body, with id="main-content" on the main element. The skip link can be visually hidden until focused using CSS positioning techniques, but it must remain in the tab order.
Form fields, if the homepage includes a contact form, each need an associated label: Email paired with . Placeholder text is not a substitute for a label, because it vanishes once typing begins and is inconsistently announced. Group related inputs in fieldset elements with legend captions when the form has logical groupings.
The document language attribute from setup, the heading outline check, and a pass with a built-in accessibility inspector cover the rest. Automated checkers catch structural problems reliably; the one thing they cannot judge is whether link text and alt text are meaningful, which needs a human read-through.
Test links, meta tags, and behavior before publishing
Before the page goes anywhere, walk a short checklist. Click every link and confirm it reaches a real destination rather than a placeholder or a 404; broken links are the most visible defect on a new homepage. Validate the markup with an HTML validator to catch unclosed tags and nesting errors, which browsers often silently repair in ways that produce surprising layouts. Confirm the title and meta description in the source match what you intend to show publicly.
Test the page with CSS disabled once more, since a late styling change involving display: none can accidentally hide meaningful content. Hide content only in ways that preserve the semantics, and never hide text that visitors need.
Check performance basics: compress photographs before upload, since multi-megabyte hero images are the usual cause of slow first loads on phones, and prefer modern formats. Defer or avoid third-party scripts on a homepage, because each added embed costs load time.
Finally, test on a real phone rather than only the emulated viewport in a desktop browser. Emulation is close, but physical-device testing catches font rendering and touch-target size problems that emulation smooths over. Touch targets should be comfortably tappable, which in practice means links and buttons with sufficient height and spacing rather than tightly packed small text links.
Choose a hosting path and deploy the file
For a static HTML homepage, hosting ranges from free static-site hosting services to shared web hosting to a folder on a server you already control. Any host that serves files over HTTP works, because there is no server-side processing to configure. The deployment act itself is upload: transfer index.html, the stylesheet, and the images folder to the host's public directory, preserving relative paths, since the href="styles.css" and href="images/favicon.png" references resolve relative to the HTML file's location.
If the host offers HTTPS—and as of 2026 nearly all mainstream options do at no extra cost—enable it, because browsers mark plain HTTP pages as not secure and some features, including certain geolocation and clipboard behaviors, are restricted outside secure contexts.
Post-deployment checks differ slightly from local checks. Request the site's root address and confirm the server returns the homepage by default rather than a directory listing. Request a deep URL and confirm relative links still resolve. Check the meta description and title as they appear to search-engine crawlers using the browser's page-source view on the live site, not the local file. Changing content later requires re-upload; for a small site, that manual cycle is fine, and version control with a repository connected to a static host automates it when that becomes worthwhile.
Common homepage failures and how to diagnose them
Everything renders as one narrow column on desktop. The viewport tag is missing or malformed, or a media query wrapper was never closed, causing its rules to cascade incorrectly. Confirm the viewport meta tag is present in the head and re-run the CSS validator.
Chinese, accented, or emoji characters display as garbled symbols. The file was saved in a non-UTF-8 encoding or the charset declaration is missing. Re-save as UTF-8 and confirm is the first child of head.
The page jumps while loading. Images lack width and height attributes, so the browser cannot reserve space. Add intrinsic dimensions to every img.
Keyboard focus disappears. A stylesheet removed the outline. Restore a visible :focus-visible style rather than relying on the default, which some resets also strip.
Links return a host error page. Relative paths broke during upload, or a link points to a page not yet created. Check the deployed directory structure against the local one and confirm destinations exist.
The header looks broken on a phone but fine on the desktop. Mobile-first rules were overridden by later desktop rules with insufficient specificity or order. Read the cascade from top to bottom: later rules win ties, and media queries do not add specificity.
When a problem persists after these checks, the productive next move is isolation: strip the stylesheet link and confirm the raw HTML behaves correctly, then reintroduce CSS in halves to find the offending rule. A browser's element inspector shows which rules apply to a selected element and which are overridden, which resolves most styling mysteries quickly.
Optional JavaScript that enhances without carrying the page
A homepage built as above needs no JavaScript to function. If you add any, keep it enhancement-only, meaning the page remains usable when scripts fail or are blocked. Three small additions cover most needs.
A mobile navigation toggle is the most common. The pattern uses a button with aria-expanded="false" and aria-controls pointing to the navigation list's id; a short script flips the attribute and a CSS class when clicked, and CSS controls visibility. The navigation links should remain in the HTML regardless, so search engines and no-JavaScript visitors see them; hiding them visually on small screens until the button is pressed is a styling concern.
Smooth scroll behavior is achievable in CSS alone with scroll-behavior: smooth on the html element, which respects users who have requested reduced motion when combined with a prefers-reduced-motion media query override. That is worth remembering: any motion you add, in CSS or JavaScript, should honor the operating system's reduced-motion setting.
Form submission, if the homepage has a contact form, requires a backend or a form-handling service; client-side JavaScript alone cannot deliver email. For a static homepage, a form-handling service or a mailto: link is the practical path, and the mailto: approach depends on the visitor having a configured mail client, which is a meaningful limitation worth stating on the page if you use it.
Test every script by disabling JavaScript in the browser and confirming the page still communicates and navigates. That check is the entire discipline of progressive enhancement in one action.
Keyboard and screen reader checks worth doing before launch
Run one final pass with tools rather than intention. Tab through the entire homepage from the address bar: focus should move through the skip link, header links, hero action, section links, and footer in an order matching the visual layout, and each focused element should show a visible ring. Activate every link with Enter and confirm the destination. Then open a screen reader—VoiceOver on macOS and iOS, Narrator on Windows, and TalkBack on Android are built in—and listen to the page with the display off if you can. The reading order should match the visual order, headings should be announced as headings, images with descriptions should be announced, decorative images should be silent, and the navigation landmark should be reachable by landmark-jump commands.
These checks take a few minutes and catch the failures that matter most: skipped heading levels, unlabeled links, misordered content, and invisible focus. Automated accessibility checkers in developer tools complement but do not replace this walkthrough, since no automated tool can judge whether a label makes sense.
The build is complete when the page loads without horizontal scrolling at phone, tablet, and desktop widths; reads coherently with styling and scripting disabled; passes the tab and screen-reader walkthrough; and every link resolves on the live server. At that point you have a homepage that is not merely designed in HTML but structurally sound, which is the foundation any later visual redesign can build on without undoing the accessibility and semantic work.