You can build and test a website on your computer, but other people cannot visit those local files. Hosting places the website files on a computer connected to the internet so browsers can load them.
A basic HTML and CSS website only needs static hosting. Static hosting stores files such as index.html, style.css, and images, then sends those files to each visitor’s browser.
Choosing Hosting
Hosting can be free or paid. Free plans are often enough for learning, personal projects, and small static websites. Paid plans may include more storage, support, email, backups, or tools for larger websites.
Before choosing a host, check that it supports the kind of website you are building. For a basic HTML and CSS site, look for clear instructions for uploading files, connecting a domain, and enabling HTTPS.
HTTPS protects information sent between the website and its visitors. Most hosting services can add it automatically, but you should confirm that it is included.
Domain Names
A domain name is the address people type to visit a website, such as example.com. Hosting stores the website, while the domain points visitors to that hosting account.
You do not need to purchase a domain while you are learning. Many hosting services provide a temporary address or project address that lets you publish a site first.
You can purchase the domain and hosting from the same company or from different companies. Using one company can make the initial setup simpler. Keeping them separate is also common, but you will need to connect them by following the companies’ domain or DNS instructions.
When choosing a domain name:
- Choose a name that is easy to read, say, and type.
- Keep it reasonably short and connected to the website’s purpose.
- Check that another organization is not already using a confusingly similar name.
- Avoid unusual spellings, dashes, or numbers when they would make the address harder to explain.
Publishing Your Files
Publishing means copying your local website files to the hosting service. The available method depends on the host.
- File manager: A tool inside the hosting dashboard that lets you upload, rename, move, and delete files. This is often the simplest method for a small beginner project.
- SFTP: A secure connection used by a separate file-transfer app or a code editor extension. It lets you move files between your computer and the hosting account.
- Git deployment: Some hosts can publish a website from a Git repository. This is useful later, but it is not required when you are starting.
Avoid using regular FTP when a secure option such as SFTP is available. Regular FTP does not protect the connection in the same way.
Basic Publishing Steps
- Create the hosting account.
- Find the folder where the host expects the public website files.
- Upload
index.html,style.css, and any image or media files while preserving their folder structure. - Open the website address in a browser.
- Check that the page loads, the CSS is working, the images appear, and the address uses HTTPS.
If the HTML loads but the styles or images do not, first check the file names, capitalization, folder locations, and paths used in the code. Paths that worked on your computer must match the file structure on the hosting account.