Build a News Website HomePage

Introduction
Hello, developers! I’m excited to share my latest project: a News Homepage Website. This project is perfect for those looking to build a clean and functional news website that showcases the latest headlines and articles. It’s a great way to enhance your frontend development skills using HTML, CSS, and JavaScript while creating a professional web experience for users.
Project Overview
The News Homepage Website is a web application designed to display the latest news articles and headlines in an organized layout. With a modern and responsive design, it allows users to easily navigate through various sections, such as Latest News, Featured Articles, and Categories. This project demonstrates how to create an informative and aesthetically pleasing website.
Features
- Responsive Layout: The website adapts to different screen sizes, providing an optimal viewing experience on both desktop and mobile devices.
- Interactive Navigation: Allows users to browse through different news categories seamlessly.
- Clean Design: Presents news articles in a visually appealing and easy-to-read format.
Technologies Used
- HTML: Provides the structure for the News Homepage Website.
- CSS: Styles the website to create a modern and responsive design.
- JavaScript: Manages the interactive elements, including dynamic content loading.
Project Structure
Here’s an overview of the project structure:
News-Homepage/ ├── index.html ├── style.css └── script.js
- index.html: Contains the HTML structure for the News Homepage Website.
- style.css: Includes CSS styles to create an engaging and responsive design.
- script.js: Manages the interactive elements of the website, such as dynamic content loading.
Installation
To get started with the project, follow these steps:
-
Clone the repository:
git clone https://github.com/abhishekgurjar-in/News-Homepage.git
Copy after login -
Open the project directory:
cd News-Homepage
Copy after login -
Run the project:
- Open the index.html file in a web browser to view the News Homepage Website.
Usage
- Open the website in a web browser.
- Navigate through the sections using the top menu to explore different news categories.
- Read the latest articles and featured news stories.
- Click on headlines to view detailed news articles.
Code Explanation
HTML
The index.html file defines the structure of the News Homepage Website, including sections for different news categories and the footer. Here’s a snippet:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>News Homepage</title>
<link
href="https://fonts.googleapis.com/css?family=Inter:100,200,300,regular,500,600,700,800,900"
rel="stylesheet"
/>
<link rel="stylesheet" href="style.css" />
<script src="script.js" defer></script>
</head>
<body>
<div class="container">
<nav class="navigation">
<div class="logo">
<img src="/static/imghw/default1.png" data-src="./assets/images/logo.svg" class="lazy" alt="Build a News Website HomePage" />
</div>
<div class="menu-icon" onclick="toggleMenu()">
<img src="/static/imghw/default1.png" data-src="./assets/images/icon-menu.svg" class="lazy" alt="Menu Icon" />
</div>
<div class="heading">
<a href="/">Home</a>
<a href="/">New</a>
<a href="/">Popular</a>
<a href="/">Trending</a>
<a href="/">Categories</a>
</div>
</nav>
<div id="mobile-menu" class="mobile-menu">
<a href="/">Home</a>
<a href="/">New</a>
<a href="/">Popular</a>
<a href="/">Trending</a>
<a href="/">Categories</a>
</div>
<main>
<div class="left-main">
<img src="/static/imghw/default1.png" data-src="./assets/images/image-web-3-desktop.jpg" class="lazy" alt="Web 3.0" />
<div class="body-text">
<h1 id="The-Bright-br-Future-of-br-Web">The Bright <br />Future of <br />Web 3.0?</h1>
<p>
We dive into the next evolution of the web that claims to put the
power of the platforms back into the hands of the people. But is
it really fulfilling its promise?
<br /><br />
<span>Read more</span>
</p>
</div>
</div>
<div class="right-main">
<h1 id="nbsp-New"> New</h1>
<div class="section">
<h3 id="Hydrogen-VS-Electric-Cars">Hydrogen VS Electric Cars</h3>
<p>Will hydrogen-fueled cars ever catch up to EVs?</p>
<hr />
</div>
<div class="section">
<h3 id="The-Downsides-of-AI-Artistry">The Downsides of AI Artistry</h3>
<p>
What are the possible adverse effects of on-demand AI image
generation?
</p>
<hr />
</div>
<div class="section">
<h3 id="Is-VC-Funding-Drying-Up">Is VC Funding Drying Up?</h3>
<p>
Private funding by VC firms is down 50% YOY. We take a look at
what that means.
</p>
<hr />
</div>
</div>
</main>
<footer>
<div class="card">
<div class="card-image">
<img src="/static/imghw/default1.png" data-src="./assets/images/image-retro-pcs.jpg" class="lazy" alt="Retro PCs" />
</div>
<div class="card-text">
<h1 id="">01</h1>
<h3 id="Reviving-Retro-PCs">Reviving Retro PCs</h3>
<p>What happens when old PCs are given modern upgrades?</p>
</div>
</div>
<div class="card">
<div class="card-image">
<img src="/static/imghw/default1.png" data-src="./assets/images/image-top-laptops.jpg" class="lazy" alt="Top Laptops" />
</div>
<div class="card-text">
<h1 id="">02</h1>
<h3 id="Top-Laptops-of">Top 10 Laptops of 2022</h3>
<p>Our best picks for various needs and budgets.</p>
</div>
</div>
<div class="card">
<div class="card-image">
<img src="/static/imghw/default1.png" data-src="./assets/images/image-top-laptops.jpg" class="lazy" alt="Growth of Gaming" />
</div>
<div class="card-text">
<h1 id="">03</h1>
<h3 id="The-Growth-of-Gaming">The Growth of Gaming</h3>
<p>How the pandemic has sparked fresh opportunities.</p>
</div>
</div>
</footer>
</div>
<div class="footer">
<p>Made with ❤️ by Abhishek Gurjar</p>
</div>
</body>
</html>
CSS
The style.css file styles the News Homepage Website, ensuring it’s visually appealing and responsive. Below are some key styles:
* {
box-sizing: border-box;
}
body {
background-color: white;
font-size: 16px;
margin: 20px;
font-family: Inter, sans-serif;
}
.container {
max-width: 1100px;
margin: auto;
}
.navigation {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
padding-block: 20px;
margin: auto;
}
.logo img {
width: 50px;
}
.heading a {
cursor: pointer;
padding-left: 20px;
text-decoration: none;
color: gray;
display: inline-block;
}
.heading a:hover {
color: rgb(253, 81, 81);
}
.menu-icon {
display: none;
cursor: pointer;
}
.menu-icon img {
width: 30px;
}
.active {
display: none;
}
.mobile-menu {
display: none;
flex-direction: column;
align-items: center;
background-color: white;
padding: 10px;
}
.mobile-menu a {
text-decoration: none;
color: gray;
padding: 10px;
display: block;
}
.mobile-menu a:hover {
color: rgb(253, 81, 81);
}
main {
width: 100%;
display: flex;
align-items: flex-start;
justify-content: space-between;
}
.left-main {
width: 80%;
padding-right: 10px;
}
.left-main img {
width: 100%;
}
.body-text {
display: flex;
}
.body-text h1 {
font-size: 40px;
width: 50%;
}
.body-text p {
font-size: 16px;
width: 50%;
}
.body-text span {
background-color: rgb(253, 81, 81);
padding: 10px;
cursor: pointer;
}
.body-text span:hover {
background-color: black;
color: white;
}
.right-main {
padding: 10px;
width: 40%;
background-color: black;
}
.right-main h1 {
color: rgb(237, 155, 15);
font-size: 25px;
}
.right-main .section {
margin: 10px;
}
.section h3 {
cursor: pointer;
color: white;
}
.section h3:hover {
color: rgb(237, 155, 15);
}
.section p {
color: gray;
}
footer {
display: flex;
align-items: center;
justify-content: space-between;
}
.card {
gap: 10px;
display: flex;
align-items: center;
justify-content: space-between;
}
.card-image img {
width: 130px;
}
.card-text h1 {
color: rgb(253, 81, 81);
}
.card-text h3:hover {
color: rgb(253, 81, 81);
}
.footer {
margin: 50px;
text-align: center;
}
@media (max-width: 600px) {
.heading {
display: none;
}
.menu-icon {
display: block;
}
main {
flex-direction: column;
justify-content: center;
align-items: center;
}
.body-text {
flex-direction: column;
align-items: center;
padding: 20px;
}
footer {
flex-direction: column;
}
}
JavaScript
The script.js file contains any dynamic functionality for the News Homepage Website. Here’s a simple snippet for demonstration:
function toggleMenu() {
const mobileMenu = document.getElementById("mobile-menu");
const menuIcon = document.querySelector(".menu-icon img");
if (mobileMenu.style.display === "flex") {
mobileMenu.style.display = "none";
menuIcon.src = "./assets/images/icon-menu.svg";
} else {
mobileMenu.style.display = "flex";
menuIcon.src = "./assets/images/icon-menu-close.svg";
}
}
Live Demo
You can check out the live demo of the News Homepage Website project here.
Conclusion
Building the News Homepage Website was a great experience in creating a clean and organized web platform for presenting news articles. This project highlights the importance of responsive design and user-friendly navigation in modern web development. By applying HTML, CSS, and JavaScript, we’ve developed a professional-looking news website that serves as a valuable resource for users. I hope this project inspires you to build your own news or content-driven websites. Happy coding!
Credits
This project was developed as part of my continuous learning journey in web development.
Author
-
Abhishek Gurjar
- GitHub Profile
The above is the detailed content of Build a News Website HomePage. For more information, please follow other related articles on the PHP Chinese website!
Hot AI Tools
Undresser.AI Undress
AI-powered app for creating realistic nude photos
AI Clothes Remover
Online AI tool for removing clothes from photos.
Undress AI Tool
Undress images for free
Clothoff.io
AI clothes remover
AI Hentai Generator
Generate AI Hentai for free.
Hot Article
Hot Tools
Notepad++7.3.1
Easy-to-use and free code editor
SublimeText3 Chinese version
Chinese version, very easy to use
Zend Studio 13.0.1
Powerful PHP integrated development environment
Dreamweaver CS6
Visual web development tools
SublimeText3 Mac version
God-level code editing software (SublimeText3)
Hot Topics
1378
52
Working With GraphQL Caching
Mar 19, 2025 am 09:36 AM
If you’ve recently started working with GraphQL, or reviewed its pros and cons, you’ve no doubt heard things like “GraphQL doesn’t support caching” or
Show, Don't Tell
Mar 16, 2025 am 11:49 AM
How much time do you spend designing the content presentation for your websites? When you write a new blog post or create a new page, are you thinking about
Building an Ethereum app using Redwood.js and Fauna
Mar 28, 2025 am 09:18 AM
With the recent climb of Bitcoin’s price over 20k $USD, and to it recently breaking 30k, I thought it’s worth taking a deep dive back into creating Ethereum
Creating Your Own Bragdoc With Eleventy
Mar 18, 2025 am 11:23 AM
No matter what stage you’re at as a developer, the tasks we complete—whether big or small—make a huge impact in our personal and professional growth.
Vue 3
Apr 02, 2025 pm 06:32 PM
It's out! Congrats to the Vue team for getting it done, I know it was a massive effort and a long time coming. All new docs, as well.
A bit on ci/cd
Apr 02, 2025 pm 06:21 PM
I'd say "website" fits better than "mobile app" but I like this framing from Max Lynch:
Let's use (X, X, X, X) for talking about specificity
Mar 24, 2025 am 10:37 AM
I was just chatting with Eric Meyer the other day and I remembered an Eric Meyer story from my formative years. I wrote a blog post about CSS specificity, and
Can you get valid CSS property values from the browser?
Apr 02, 2025 pm 06:17 PM
I had someone write in with this very legit question. Lea just blogged about how you can get valid CSS properties themselves from the browser. That's like this.


