Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • jQuery
  • AngularJS
  • ReactJS
  • Next.js
  • React Native
  • NodeJS
  • Express.js
  • MongoDB
  • MERN Stack
  • PHP
  • WordPress
  • Bootstrap
  • Tailwind
  • CSS Frameworks
  • JS Frameworks
  • Web Development
Open In App
Next Article:
Design a Tribute Page using HTML and CSS
Next article icon

How to Create a Website Using HTML and CSS?

Last Updated : 04 Feb, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

Creating a website using HTML and CSS is a foundational skill if you are learning web development. HTML (HyperText Markup Language) is used to structure content, while CSS (Cascading Style Sheets) is used for styling, including colors, fonts, margins, and positioning. In this article, we’ll go through the steps to create a simple, responsive webpage.

Screenshot-2024-01-15-170222

Approach

  • Basic HTML Structure:
    Start by creating a fundamental layout that includes a navigation bar with a logo and navigation links.
  • Search Box:
    Add a search box and a search button within the navigation menu.
  • Header Section:
    Use the <header> tag to include a title and introductory content.
  • Main Content Sections:
    Divide the primary content into sections using <section> tags and style them with CSS.
  • Footer Section:
    Use the <footer> tag for copyright information or other footer content.
  • Responsive Design:
    Implement media queries in CSS to ensure the layout adapts seamlessly across various devices

Example: Creating a Simple Web Page

Before creating the website, set up the structure of your project. Follow these steps:

1. Create the HTML File

  • Name the file index.html (or another name of your choice).
  • This file will contain the structural content of your webpage.

2. Create the CSS File

  • Name the file style.css (or another name, as long as you link it correctly).
  • This file will include all the styling rules for your webpage, such as colors, fonts, and layouts.

3. Link the CSS to the HTML File

  • In the <head> section of your HTML file (index.html), link the CSS file using the <link> tag, as shown below:
<link rel="stylesheet" href="style.css">

Ensure the style.css file is in the same directory as your index.html, or adjust the file path accordingly if it is in a different folder.

HTML
<!DOCTYPE html> <html>  <head>     <title>Simple web page Template</title>     <link rel="stylesheet" href="style.css"> </head>  <body>     <nav class="navbar background">         <div class="logo">             <img src="https://media.geeksforgeeks.org/gfg-gg-logo.svg" style="height: 30px;" alt="Logo">         </div>         <ul class="nav-list">             <li><a href="#web">Web Technology</a></li>             <li><a href="#program">C Programming</a></li>             <li><a href="#course">Courses</a></li>         </ul>         <div class="rightnav">             <input type="text" name="search" id="search">             <button class="btn btn-sm">Search</button>         </div>     </nav>      <section class="firstsection">         <div class="box-main">             <div class="firstHalf">                 <h1 class="text-big" id="web">Web Technology                 </h1>                 <p class="text-small">                     HTML stands for HyperText Markup Language.                     It is used to design web pages using a markup                     language. HTML is the combination of Hypertext                     and Markup language. Hypertext defines the                     link between the web pages. A markup language                     is used to define the text document within tag                     which defines the structure of web pages.                     HTML is a markup language that is used by the                     browser to manipulate text, images, and other                     content to display it in the required format.                 </p>               </div>         </div>     </section>      <section class="secondsection">         <div class="box-main">             <div class="firstHalf">                 <h1 class="text-big" id="program">                     C Programming                 </h1>                 <p class="text-small">                     C is a procedural programming language. It                     was initially developed by Dennis Ritchie                     as a system programming language to write                     operating system. The main features of C                     language include low-level access to memory,                     simple set of keywords, and clean style,                     these features make C language suitable for                     system programming like operating system or                     compiler development.                 </p>             </div>         </div>     </section>      <section class="section">         <div class="paras">             <h1 class="sectionTag text-big">Java</h1>             <p class="sectionSubTag text-small">                 Java has been one of the most popular                 programming language for many years.                 Java is Object Oriented. However it is                 not considered as pure object oriented                 as it provides support for primitive                 data types (like int, char, etc) The                 Java codes are first compiled into byte                 code (machine independent code). Then                 the byte code is run on Java Virtual                 Machine (JVM) regardless of the                 underlying architecture.             </p>         </div>     </section>      <footer class="background">         <p class="text-footer">             Copyright ©-All rights are reserved         </p>     </footer> </body>  </html> 
CSS
* {     margin: 0;     padding: 0; }  .navbar {     display: flex;     align-items: center;     justify-content: center;     position: sticky;     top: 0;     padding: 15px;     cursor: pointer; }  .background {     background: black;     background-blend-mode: darken;     background-size: cover; }  .nav-list {     width: 70%;     display: flex;     align-items: center;     gap: 20px;     list-style: none; }  .logo {     display: flex;     justify-content: center;     align-items: center; }  .logo img {     width: 180px;     border-radius: 50px; }  .nav-list li {     list-style: none;     padding: 26px 30px;     padding: 10px; }  .nav-list li a {     text-decoration: none;     color: white; }  .nav-list li a:hover {     color: grey; }  .rightnav {     width: 30%;     text-align: right; }  #search {     padding: 5px;     font-size: 17px;     border: 2px solid grey;     border-radius: 9px; }  .firstsection {     background-color: green;     height: 400px; }  .secondsection {     background-color: blue;     height: 400px; }  .box-main {     display: flex;     justify-content: center;     align-items: center;     color: black;     max-width: 80%;     margin: auto;     height: 80%; }  .firsthalf {     width: 100%;     display: flex;     flex-direction: column;     justify-content: center; }  .secondhalf {     width: 30%; }  .secondhalf img {     width: 70%;     border: 4px solid white;     border-radius: 150px;     display: block;     margin: auto; }  .text-big {     font-family: 'Piazzolla', serif;     font-weight: bold;     font-size: 35px; }  .text-small {     font-size: 18px; }  .btn {     padding: 8px 20px;     margin: 7px 0;     border: 2px solid white;     border-radius: 8px;     background: none;     color: white;     cursor: pointer; }  .btn-sm {     padding: 6px 10px;     vertical-align: middle; }  .section {     height: 400px;     display: flex;     align-items: center;     justify-content: center;     max-width: 90%;     margin: auto; }  .section-Left {     flex-direction: row-reverse; }  .paras {     padding: 0px 65px; }  .thumbnail img {     width: 250px;     border: 2px solid black;     border-radius: 26px;     margin-top: 19px; }  .center {     text-align: center; }  .text-footer {     text-align: center;     padding: 30px 0;     font-family: 'Ubuntu', sans-serif;     display: flex;     justify-content: center;     color: white; }  footer {     text-align: center;     padding: 15px; }   .rightnav {     width: 100%;     text-align: right;     margin-top: 10px; }  #search {     box-sizing: border-box;     width: 70%;     padding: 8px;     font-size: 17px;     border: 2px solid grey;     border-radius: 9px; }  .btn-sm {     padding: 8px 20px;     margin: 7px 5px; }  img {     max-width: 100%;     height: auto; } 

Output: 

Design-a-web-page-using-HTML-and-CSS

Design a web page using HTML and CSS Example Output



Next Article
Design a Tribute Page using HTML and CSS

C

codingbeast12
Improve
Article Tags :
  • Web Technologies
  • Web Templates

Similar Reads

  • How to Create a Website Using HTML and CSS?
    Creating a website using HTML and CSS is a foundational skill if you are learning web development. HTML (HyperText Markup Language) is used to structure content, while CSS (Cascading Style Sheets) is used for styling, including colors, fonts, margins, and positioning. In this article, we’ll go throu
    5 min read
  • Design a Tribute Page using HTML and CSS
    Making a tribute page is an Innovative way to honor someone special in your life. In this article, we create a tribute webpage using HTML and CSS. This page has a simple and creative design. It contains a header with a title, a main section with text and images, and a footer for main details or cred
    4 min read
  • Build a Survey Form using HTML and CSS
    Creating a survey form is a great way to understand the basics of web development. In this tutorial, we will build a Survey Form that allows users to easily submit their responses. The form will include different input types such as text fields, checkboxes, and radio buttons, all designed using HTML
    4 min read
  • Design a Parallax Webpage using HTML and CSS
    A parallax website includes fixed images in the background that are kept in place and the user can scroll down the page to see different parts of the image. In this article, we are creating a parallax webpage using HTML and CSS. We will use basic tags of HTML like div, paragraph, and heading to writ
    4 min read
  • Design an Event Webpage using HTML and CSS
    Creating an event webpage is an exciting way to showcase information about an event, including its schedule, speakers, and contact details. What We’re Going to CreateWe’ll create a webpage for a fictional event called "GeeksforGeeks TechCon 2025." This webpage will include A header introducing the e
    5 min read
  • Design a Webpage for online food delivery system using HTML and CSS
    Creating your own online food delivery website is a great way to present a user-friendly platform for customers to browse and order food online. In this project, we’ll design a simple yet effective food delivery website using HTML and CSS. What We’re Going to Create...We’ll develop a straightforward
    7 min read
  • Create a Homepage for Restaurant using HTML , CSS and Bootstrap
    HTML: HTML stands for Hyper Text Markup Language. It is used to design web pages using a markup language. HTML is a combination of Hypertext and Markup language. Hypertext defines the link between the web pages. A markup language is used to define the text document within the tag which defines the s
    6 min read
  • How to create a Landing page using HTML CSS and JavaScript ?
    A landing page, also referred to as a lead capture page, static page, or destination page, serves a specific purpose and typically appears as a result of online advertising or search engine optimization efforts. Unlike a homepage, a landing page is stripped of distractions and focuses on capturing v
    7 min read
  • Design a Webpage like Technical Documentation using HTML and CSS
    In this article, we will design a webpage-like technical documentation using HTML and CSS . Technical documentation is any document that explains the features of the respective product. In this project, we are going to create technical documentation of C++ by using HTML and CSS. The webpage has a me
    9 min read
  • Create a Music Website Template using HTML, CSS & JavaScript
    A Music Website Template is a pre-designed layout for creating a music-themed webpage. By utilizing HTML, CSS, and JavaScript, developers can craft a functional and visually appealing website with features like play/pause controls, sections for home, music, about, and contact. Approach: We will crea
    3 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences