HTML & CSS Website Creation Tutorial
Step 1: Setting Up the Environment
1. Create a Project Folder:
- On your computer, create a new folder where you'll store your website files.
- Example: Name it "MyWebsite".
2. Open Visual Studio Code:
- Open Visual Studio Code (VS Code).
- Select 'File' > 'Open Folder' and choose your "MyWebsite" folder.
Step 2: Creating the HTML File
1. Create `index.html`:
- In VS Code, right-click in the Explorer pane.
- Select 'New File' and name it `index.html`.
2. Basic HTML Structure:
- In `index.html`, type out the basic HTML structure.
<!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="style.css">
</head>
<body>
<!-- Content goes here -->
</body>
</html>
Step 3: Creating the CSS File
1. Create `style.css`:
- Create a new file named `style.css` in the same folder.
- This file will be used to style your HTML content.
Step 4: Building the Website Structure
1. Navbar with Logo:
- In `index.html`, add a navigation bar with a logo.
<nav>
<img src="logo.png" alt="Logo" class="logo"> <!-- Replace 'logo.png' with your
logo file -->
<div class="nav-items">
<a href="#">Home</a>
<a href="#">About</a>
<a href="#">Contact</a>
</div>
</nav>
2. Banner and Main Image:
- Add a banner and a main image in the body.
<div class="banner">
<img src="banner.jpg" alt="Banner"> <!-- Replace 'banner.jpg' with your banner
file -->
</div>
<div class="main-image">
<img src="main.jpg" alt="Main Image"> <!-- Replace 'main.jpg' with your main
image file -->
</div>
3. Footer:
- Add a footer to the HTML file.
```html
<footer>
<div class="footer-content">
<!-- Add footer content here -->
<p>© 2023 My Website</p>
</div>
</footer>
Step 5: Styling with CSS
1. Styling Elements:
- Open `style.css` and add styles for your navbar, banner, main image, and footer.
```css
body {
margin: 0;
padding: 0;
font-family: Arial, sans-serif;
}
nav {
/* Add navbar styles here */
}
.banner, .main-image {
width: 100%;
display: block;
}
footer {
/* Add footer styles here */
}*/
}
.banner, .main-image {
width: 100%;
display: block;
}
footer {
/* Add footer styles here */
}
```
Step 6: Viewing Your Website
- Open your `index.html` in a web browser to view your website.