How can we create a simple website using html and css?
Want to learn how to create a website with HTML and CSS? You’re in the right place. In this guide, we show you all the steps to get from a blank screen to a working website that’s optimized and quite good-looking at the same time. But first, what is HTML and CSS? Well, you could just look up both terms in Wikipedia, but those definitions aren’t very reader-friendly. Let’s simplify things a bit: You can’t really have one without the other – the two work together to make up the final web page, its design, and the content that’s on it. Note; when
we say “a web page,” what we mean is a single HTML document – a single page that’s part of your website. Whereas, “a website” is the complete thing – your whole site with all its individual web pages. Table of contents If you think this is too complicated, we recommend either creating a website using WordPress or choosing one of the website builders. Before You Start, Gather Your Resources:So, the first thing you need even before creating a website with HTML and CSS is a web server (hosting). Don’t worry, though; you don’t have to buy your own machine. Many web hosting companies will sell you a simple hosting service on their machines. Just google for “web hosting” and pick something that isn’t too expensive or check our web hosting reviews. With the server sorted, the next thing you need is a domain name. The domain name is what the website is identified on the web. For example, this site’s domain name is When you have both a domain name and a server, you can connect the two together. To have this sorted out with no pain on your end, we recommend signing up with a company like Bluehost. They will handle all the setup for you. Meaning that they will: (a) set up a hosting account for you, (b) register a domain name on your behalf, (c) configure everything to work together, and (d) give you access to an easy-to-use dashboard. Go ahead and sign up with any of the web hosting services, we’ll wait. When you’re back and have your web server configured and ready to go, scroll to the next step. P.S. If you just want to experiment with an HTML website on your computer, and don’t intend to make it public, use a local web server software. The one we recommend and like to use is called XAMPP. It has versions for both Mac and PC, and it’s easy to use. Here’s a guide on how to install it on your computer. 1. Learn the Basics of HTMLIf you are a new to HTML, you may find this HTML for Beginners (Ultimate Guide) useful. The main element of an HTML structure is an HTML tag. A tag, for example, looks like this: SOMETHING Here, we’re dealing with a But there are other tags, just to name a few:
Apart from those simple tags, there are also more complex tags. For example, if you want to build a list like the following:
… you can do that with the following HTML code:
Or, if you want to add a link to another page, like this one: This is a link to our homepage … you can do that with this piece of code: This is a link to my homepage Read this to get the full list of HTML tags. It’ll become useful as you’re creating a website with HTML and CSS. 2. Understand HTML Document StructureThink of your HTML page as if it was built of Legos. You put different bricks on top of one another to end up with a given bigger structure. But instead of Lego bricks, you get HTML tags… Here’s the simplest HTML document structure:
You can take the code above, copy and paste it to a new file, save the document as Let’s explain the individual parts of this code:
An important note here. Working on an HTML file in a basic text app or a complex text processor like MS Word is not a good experience. To make things easy on yourself, install a HTML editor called Sublime Text. It has versions for both Mac and PC, and it is free. Why is it better? Among other things, it will colorize the syntax of an HTML file. Meaning, it’ll visually distinguish your HTML tags from text content, tag parameters, and other values. Basically, it’ll all become readable. Here’s what our simple HTML structure looks like in Sublime Text: Okay, back on topic. You can take that new Okay, so the page is ugly, how to make it not so? 3. Get to Know CSS SelectorsJust like HTML has its tags, CSS has selectors. Selectors describe how a given element should behave appearance-wise. Here’s an example of a CSS selector: p { font-size: 18px; } This selector indicates that all HTML However, a more practical way of using CSS selectors is not to restrict all tags of a given type to a certain styling, but rather create different “classes” and assign them to tags one by one. For example, a class selector in CSS looks like this: .normal-text { font-size: 18px; } Notice the dot ( For example:
Let’s take one more minute to explain all the elements of that piece of CSS code above:
There’s a ton of CSS properties apart from the above 4. Put Together a CSS StylesheetAn HTML document is very structural – every element has its place, and the order of elements is crucial for the final construction and appearance of the web page in question. A CSS document is a lot less so. CSS documents are often referred to as stylesheets. Basically, a CSS stylesheet is a list of all the class definitions that are being used in the corresponding HTML document. The order of the class definitions is not that crucial most of the time (at least for simple designs). The way you put a CSS stylesheet together is by defining each class one by one, and then testing if the outcome in your page design is what you wanted. This sounds like tedious work, and it is. But we’ll make things easier on you, and not force you to learn HTML and CSS design by hand. Instead of teaching you everything from scratch, we’ll take a living organism and dissect its elements. This is where a thing called Bootstrap comes into play. 5. Download/Install BootstrapBootstrap is an open-source toolkit for creating a website with HTML and CSS. In plain English, Bootstrap takes care of the basic structure of an HTML document and CSS stylesheet for you. It delivers a framework that makes sure that the main scaffolding of your web page is ready and optimized for further development. Basically, Bootstrap lets you not start from scratch, and instead go right into the fun part. With it, you don’t have to work on the often boring early stages of creating a website with HTML and CSS. There are two paths you can take:
Option (a) might have some learning curve at the beginning, but it’s not in any way the worse way to approach creating a website with HTML and CSS. Once you master the core Bootstrap structure, it might be easier for you to build new pages and make them look exactly as you want them. The Bootstrap documentation is a great place to get started with this path. We’re going to go with Option (b) for this guide. We’re doing this for a couple of reasons, chief of them: Starting with a ready-made structure saves a lot of pain in trying to figure out the basic necessities of an HTML document. This lets you focus on the interesting stuff – like laying out content and making it look good. In short, learning things this way will give you a better-looking result quicker, which we guess is what you want. 6. Pick a DesignWhen you’re creating a website with HTML and CSS, you are free to use any Bootstrap template you like. They should all work similarly enough. However, for this guide, we’re going to use one of the templates by Start Bootstrap. They have a nice selection of free templates that are optimized, work trouble-free, and are also very well designed. The theme we’re going to use is called Creative. The final effect we’re going for will look something like this: To begin with, the Creative template, click on the Free Download button that’s on the right (on this page) and save the zip package to your desktop. Unzip the package and move its contents to the main directory of your local web server or your web hosting account. Now open that location through your web browser. You’ll see the stock version of the template: It’s already quite good-looking, but now it’s time to learn how to use HTML and CSS to make it into exactly what you want it to be. 7. Customize Your Website With HTML and CSSLet’s work on the homepage of the design first. This is going to show us how to replace the graphics, texts, and tune everything up in general. We’ve talked about the head section of an HTML document briefly above. Let’s have a more in-depth look into it here. When you
open the
* Apart from the above, there was also code to load Google Fonts, Font Awesome icons and a lightbox module for the images displayed on the page. Most of the declarations here we already know, but there are a couple of new ones:
Let’s modify that last declaration – the line loading the CSS – to make it easier to work with later on. Change that line to: This is just a small difference – it’ll load the non-shortened version of the same CSS sheet. This version is just easier to modify. Now scroll down to the very bottom of the They’re responsible for loading JavaScript files that handle some of the more visual interactions of the design. For instance, when you click on the About link in the top menu, you’ll be taken smoothly to the about block on the same page – this, among other things, is done via JavaScript. We don’t need to trouble ourselves understanding this code right now. Let’s leave this for another time. Instead, let’s work on adding our own content to the page: 8. Add Content and ImagesThe first thing you’ll want to do is change the title of the page. 1. Change the TitleFind the title tag in the head section and replace the text between the tags to something of your own:
2. Customize the Hero SectionThe hero section is what we call this block: It would be cool to have our own content inside of it. To modify this block, go
back to your
This whole block of code controls what’s in the hero section. There are some new tags here:
|