Apollo Editor
Windows 10 & 11 Buy now · $69.95
Website management

How to Update an Old Website to Modern HTML5 and CSS

Update an old table-and-font-tag website to modern HTML5 and CSS step by step: doctype, viewport, styles, layout and mobile-friendly checks.

Updated 5 minute read The Apollo Editor team

To update an old website to HTML5, start with a backup, then give each page the short HTML5 doctype, a UTF-8 character encoding and a viewport meta tag. Next, move formatting such as <font> tags, <center> and bgcolor attributes into a shared CSS stylesheet, and replace table-based layouts with CSS Flexbox or Grid so the pages work on phones. You can usually do this one page at a time, without rebuilding the site from scratch.

This guide covers how to spot what needs changing, the order to work in, the common replacements, and how to check the result.

Signs your website needs updating

Older sites often still display in modern browsers, which is why they get left alone. But if you open a page's source and see any of the following, it was built for an earlier generation of the web:

  • A long doctype mentioning HTML 4.01 or XHTML, or no doctype at all.
  • No <meta name="viewport"> tag, so phones show a tiny, zoomed-out desktop page.
  • <font>, <center>, <big>, <strike> or <marquee> tags.
  • Attributes such as bgcolor, align, cellpadding and border on tables and cells.
  • The whole page laid out inside a large table, often with spacer images to push things into place.
  • Frames (<frameset>) holding the menu and content in separate files.

These elements and attributes are listed as obsolete in the HTML standard. Browsers still try to display most of them, but they make a site hard to maintain, hard to use on phones and harder for screen readers.

Prepare before you change anything

  1. Back up the whole site folder. Keep an untouched copy you can go back to.
  2. List your pages and note which ones get the most visitors. Update those first.
  3. Keep the same file names and addresses where you can. Changing about.htm to about.html breaks links and bookmarks unless you set up redirects.
  4. Pick one simple page as a test. Get it right, then use it as the pattern for the rest.

Step 1: fix the head of each page

These three changes are quick and safe, and they make the biggest immediate difference.

  • Replace the old doctype with <!DOCTYPE html> on the very first line.
  • Add a language to the opening tag, such as <html lang="en">.
  • Declare the encoding with <meta charset="utf-8"> near the top of the head, and remove the older, longer encoding meta tag.
  • Add the viewport tag: <meta name="viewport" content="width=device-width, initial-scale=1">.

If your files were saved in an older encoding, make sure they are actually saved as UTF-8 after you change the tag, or special characters such as accented letters may show up garbled. While you are in the head, check that every page has its own title and meta description.

Adding the viewport tag to an old fixed-width layout can make some pages look worse on phones at first, because the browser stops shrinking the page to fit. That is expected. Step 3 fixes the layout.

Step 2: move formatting into CSS

Create one stylesheet, such as css/style.css, and link it from every page with <link rel="stylesheet" href="css/style.css"> (adjust the path for pages in subfolders). Then replace old formatting with CSS rules. Common swaps:

Old markupModern replacement
<font face="Arial" size="2" color="red">font-family, font-size and color in CSS, on the body or a class
<center>text-align: center for text, or margin: 0 auto for a block
bgcolor and background attributesbackground-color and background-image in CSS
align on images and paragraphstext-align, Flexbox or float in CSS
border, cellpadding, cellspacing on tablesborder, padding and border-collapse in CSS
<strike>, <big><s> or <del>, and CSS font-size
<marquee>Usually just static text. If movement is essential, CSS animation.

Set your main font, size and colors once on body, and style headings with h1, h2 and h3 rules. Often most of the <font> tags can then simply be deleted, because the stylesheet already gives the text the right look. If you have the same tag repeated across many pages, a site-wide find and replace can remove it in one pass. See how to find and replace across a whole website.

Also check that headings are real headings. Old sites often fake them with large bold text. Using proper <h1> to <h3> tags helps visitors, screen readers and search engines.

Step 3: replace layout tables and frames

This is the biggest job, so take it page by page. The usual approach:

  1. Identify the regions of the old table: typically a header, a menu, the main content and a footer.
  2. Rebuild them with semantic elements: <header>, <nav>, <main> and <footer>.
  3. Lay them out with CSS. Flexbox suits a row of menu links or a sidebar beside content. Grid suits a whole-page layout. See CSS Flexbox vs Grid.
  4. Add a media query so columns stack on narrow screens.
  5. Replace fixed widths such as width="800" with a max-width and flexible widths, and give images max-width: 100%.

Keep tables for what they are good at: genuine rows and columns of data, such as price lists or opening hours.

If the site uses frames, rebuild each content page as a full page with the menu written into it. The menu then needs to be the same on every page. See how to keep the same header and footer on every page for ways to manage that.

Step 4: check your work

  • Validate each page with the W3C Markup Validation Service or your editor's validator, and fix the errors it reports.
  • Test at phone, tablet and desktop widths. Text should be readable without zooming and nothing should scroll sideways.
  • Check links and images, especially if you moved or renamed any files.
  • Look at the page in more than one browser.

Once every page passes, upload the updated files, replacing the old ones with the same names.

The easier way: modernize old pages in Apollo Editor

Apollo Editor is a Windows desktop HTML editor that opens ordinary HTML and HTM files and whole site folders, and preserves your existing source code where possible instead of silently removing unfamiliar elements.

  • Split view shows the page and its HTML side by side, kept in sync, so you can see what each old tag does before you replace it.
  • Page Properties sets the language, character encoding, viewport, title and meta description, and the CSS Style Designer builds the replacement styles, including Flexbox, Grid and responsive breakpoints.
  • Code view validation highlights HTML and CSS errors, and Preview shows desktop, tablet and phone sizes.
  • Site-wide find and replace and broken link detection help with changes across many pages.

Your pages stay plain, portable HTML throughout. To get started, see the quick start or all features.

Frequently asked questions

Do I have to rebuild my old website from scratch?

Not always. Adding a modern doctype and viewport tag, moving formatting into CSS and fixing the layout for phones can be done page by page.

Are font tags still allowed in HTML?

The font tag is obsolete in HTML5. Browsers still display it, but text styling should be done with CSS instead.

Is using tables for page layout wrong?

Layout tables still display, but they are hard to make work on phones and confuse screen readers. CSS Flexbox and Grid are the modern way.

Get three guides like this every month, plus software update notices.Subscribe →