Here is an example of HTML and CSS code to create a basic YouTube homepage design:
HTML:
<!DOCTYPE html>
<html>
<head>
<title>YouTube Homepage</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<header>
<div class="logo">
<img src="logo.png" alt="YouTube Logo">
</div>
<div class="search-bar">
<input type="text" placeholder="Search">
<button>Search</button>
</div>
<div class="nav-links">
<a href="#">Home</a>
<a href="#">Trending</a>
<a href="#">Subscriptions</a>
</div>
</header>
<main>
<div class="video-thumbnails">
<div class="video-thumbnail">
<img src="video1.png" alt="Video 1 Thumbnail">
<h2>Video 1 Title</h2>
<p>Video 1 Description</p>
</div>
<div class="video-thumbnail">
<img src="video2.png" alt="Video 2 Thumbnail">
<h2>Video 2 Title</h2>
<p>Video 2 Description</p>
</div>
<!-- Add more video thumbnails here -->
</div>
</main>
</body>
</html>
CSS (in style.css file):
header {
background-color: #fff;
padding: 20px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}
.logo {
margin-right: 20px;
}
.search-bar {
margin-right: 20px;
}
.search-bar input {
width: 200px;
height: 30px;
padding: 10px;
border: 1px solid #ccc;
border-radius: 5px;
}
.search-bar button {
background-color: #4CAF50;
color: #fff;
border: none;
padding: 10px 20px;
border-radius: 5px;
cursor: pointer;
}
.nav-links {
margin-right: 20px;
}
.nav-links a {
margin-right: 20px;
color: #333;
text-decoration: none;
}
.video-thumbnails {
display: flex;
flex-wrap: wrap;
justify-content: center;
}
.video-thumbnail {
margin: 20px;
width: 250px;
}
.video-thumbnail img {
width: 100%;
height: 150px;
object-fit: cover;
border-radius: 5px;
}
.video-thumbnail h2 {
margin-top: 10px;
font-weight: bold;
}
.video-thumbnail p {
margin-top: 10px;
color: #666;
}
Note: This is a basic example and you will need to add more styles and functionality to create a fully functional YouTube homepage.