Learning to Use HTML & CSS: Your First Webpage

Want to build a website but don't know how to get started? With HTML and CSS, you can design your first web page today! Let me explain some basic steps, tips, and additional resources you can use to get underway on this exciting journey into the world of web development.

Why Start with HTML and CSS?

HTML and CSS are the very building blocks on which any website is founded. HTML, or Hypertext Markup Language, is representative of the skeleton of a webpage, defining both structure and content of the page. Meanwhile, CSS, or Cascading Style Sheets, colors your page, font, and layouts to bring it to life. They will combine to allow you to build full, functional, and pleasing web pages.

Step 1: Setup Your Workspace

Setup a simple coding environment: If you are a beginner, you may simply need a plain text editor, which comes free with your operating system, such as Notepad on Windows and TextEdit on macOS, or even better, a free code editor such as VS Code or Atom.

Pro Tip: Create a parent folder for your project, and inside this folder add two files: one to house your HTML, index.html, and a second one for your CSS, styles.css. This will help you keep your project organized and, if it develops into an app, you would make life much easier for yourself by keeping all relevant files handy in one location.

Step 2: The Basics of HTML

HTML adds structure to the content of your page with the help of "tags." Here are some of the first tags that you should know:

<html> and <body>: These wrap your entire page content.

<h1> to <h6>: Heading tags for titles and subheadings.

<p>: The paragraph tag for body text.

<img>: Inserts images.

<a>: Creates hyperlinks.

Now, try building a basic structure like this:

<!DOCTYPE html>

<html lang="en">

<head>

<meta charset="UTF-8">

<meta name="viewport" content="width=device-width, initial-scale=1.0">

<title>My First Web Page</title>

</head>

<body>

<h1>Welcome to My Web Page</h1>

This is my first web page, built with HTML!

</body>

</html>

Replace text in <h1> and <p> with your own text!

Step 3: Add Style with CSS

Now, let's give it some style with CSS. CSS is what you'd use to control visual styling, like colors, fonts, and spacing. Here's some example styling that can be used to beautify your page:

/* styles.css */

body {

font-family: Arial, sans-serif;

background-color: #f0f0f0;

color: #333;

text-align: center;

}

h1 {

color: #4CAF50;

}

p {

font-size: 18px;

}

Linking CSS to HTML How to link your CSS to your HTML file. Remember, your CSS file needs to be linked inside the head of your HTML document. Example:

<link rel="stylesheet" href="styles.css">

Now, go and play with colors and font sizes to understand how each of these changes affects your page. With CSS, everything is editable, so get creative!

Step 4: Responsive Design Basics

Make sure your website looks good on every device with the help of media queries. That's a kind of CSS technique which will help your page change its layout on the go depending on screen size. Here's a simple example:

/* styles.css */

@media (max-width: 600px) {

body {

font-size: 16px;

}

h1 {

font-size: 24px;

}

}

Now, when the screen width is 600px or smaller, such as on a phone, the font sizes will be smaller to fit better.

Step 5: Troubleshooting and Testing

Coding rarely goes without a hitch, especially the first time. Here is what to do when things are not working:

Check your code for typos. Sometimes one character in the wrong place will cause something not to work.

There's something in the browser called Developer Tools. Right click on your page, and click "Inspect" or "Inspect Element" to see what is going on behind the scenes.

Try it out in different browsers such as Chrome, Firefox, Safari to make certain everything appears as well as behaves the way you want it to.

Remember, the best way to learn is by doing. Go ahead and try different tags of HTML, different properties of CSS - don't be afraid to make mistakes!

Step 6: Learn from Free Resources

There are plenty of resources out there that can help you learn HTML and CSS. Here are some recommended ones:

W3Schools - Great for quick references and tutorials on HTML/CSS basics.

MDN Web Docs (Mozilla) - A thorough resource on web technologies including HTML and CSS. Codecademy Free courses that will walk you through step-by-step to build projects. Each of the resources listed will allow you to dig in deeper and understand the technologies, which in turn builds your confidence as you build.

Wrap Up

Knowing HTML and CSS is just the very beginning one needs to master for web development, since these form the backbone of any website. And this, with constant practice, will get you starting to create more complex layouts and adding interactivity to your pages using JavaScript in no time.

What's Next? Once comfortable, try building a multi-page site or dive into CSS frameworks like Bootstrap to see how they can help speed up the development process!

The fun times ahead! Your very first webpage, created with HTML and CSS, is endless in possibility. Now keep experimenting, learning, and sharing what you learn further. Every written line brings you closer to mastery in this whole web development realm.

What are you building next? Share your thoughts and experiences in the comments!

0
Subscribe to my newsletter

Read articles from Okoye Ndidiamaka directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Okoye Ndidiamaka
Okoye Ndidiamaka

Amaka Okoye: LLB holder, web developer, and automation expert. Transforms ideas into digital reality. Committed to learning and self-improvement.