Embarking on your web development journey? You've likely encountered HTML and CSS, the backbone of web design. But where do you store and share your projects? Enter GitHub, the world's leading platform for version control and collaboration. Let's explore how to create, style, and host your HTML and CSS websites on GitHub.

Before we dive in, ensure you have a GitHub account and understand the basics of Git. If not, fear not! GitHub offers excellent documentation and tutorials to get you started.

Setting Up Your HTML and CSS Project
First, let's create a new repository (repo) on GitHub for your project. Log in to your GitHub account, click the '+' icon in the top-right corner, and select 'New repository'. Name it something descriptive, like 'my-website', and initialize it with a README.md file.

Now, let's set up your project locally. Create a new folder on your computer, navigate into it, and initialize a new Git repository using the command 'git init'. Inside this folder, create two files: 'index.html' and 'styles.css'.
Structuring Your HTML

Open 'index.html' and write your basic HTML structure. A simple one might look 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 Website</title> <link rel="stylesheet" href="styles.css"> </head> <body> <h1>Welcome to My Website!</h1> </body> </html>
Notice the link to 'styles.css' in the head? This is where we'll apply our styling.
Styling with CSS

Open 'styles.css' and add some basic styling:
body {
font-family: Arial, sans-serif;
margin: 0;
padding: 2rem;
background-color: #f0f0f0;
}
h1 {
color: #333;
}
Here, we've set the body's font, margin, padding, and background color, and changed the color of the h1 heading.
Connecting Your Local Project to GitHub

Now, let's connect your local project to your GitHub repository. First, add your files to Git using the commands 'git add .', 'git commit -m "Initial commit"', and 'git remote add origin https://github.com/yourusername/my-website.git'.
Finally, push your changes to GitHub with 'git push -u origin main'.




















Publishing Your Website on GitHub
GitHub provides a simple way to host your static websites. In your repository's settings, scroll down to the 'Pages' section. Under 'Source', select 'main' (or 'master', depending on your default branch name), and click 'Save'. Your website will now be live at 'https://yourusername.github.io/my-website'.
To update your website, simply make changes locally, push to GitHub, and GitHub Pages will update automatically.
And there you have it! You've created, styled, and hosted your HTML and CSS website on GitHub. Happy coding, and remember to keep learning and experimenting to improve your skills.