Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • 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
  • JS Tutorial
  • JS Exercise
  • JS Interview Questions
  • JS Array
  • JS String
  • JS Object
  • JS Operator
  • JS Date
  • JS Error
  • JS Projects
  • JS Set
  • JS Map
  • JS RegExp
  • JS Math
  • JS Number
  • JS Boolean
  • JS Examples
  • JS Free JS Course
  • JS A to Z Guide
  • JS Formatter
Open In App

Create a Music Website Template using HTML, CSS & JavaScript

Last Updated : 24 May, 2025
Comments
Improve
Suggest changes
Like Article
Like
Report

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.

Step-by-Step Guide to create to Create a Music Website Template Project

  • We will create the basic layout, i.e., two divs (left and right) inside one div tag. In the left div, we will write some text, and in the right div, we will place a play or pause image. We will also create a basic nav-bar and float it to the right.
  • With the help of CSS, we will beautify our overall structure by giving background images, padding, margin, etc.
  • We will use basic JavaScript functions like onclick(), play(), pause(), and getElementById() to get the current status of the music and make changes accordingly.
  • When the user will play the music we will show a play image or icon and when the user presses pause image or icon will be displayed. This is done using a simple if-else statement.

Example: In this example, we are using the above-explained approach.

index.html
<!DOCTYPE html> <html lang="en"> <head>     <style>         /* Styling the body */         * {             padding: 0;             margin: 0;         }         /* Styling the background image by          giving its url and position */         .container {             height: 100vh;             width: 100%;             background-image: url('https://media.geeksforgeeks.org/wp-content/uploads/20210402235143/background.jpg');             /* Image used: */             background-size: cover;             background-position: center;             position: relative;         }         /* Styling the list tags to the          right of the navigation bar */         .nav li {             float: right;             list-style: none;         }         /* Styling the anchor tags of          the navigation bar */         .nav a {             list-style: none;             height: 50px;             line-height: 50px;             font-size: 1rem;             font-weight: 550;             display: block;             padding: 5px 35px;             color: black;             text-decoration: none;         }         /* Giving position and margin          to the content-div */         .content {             width: 100%;             position: absolute;             top: 45%;         }         /* Styling the left-col by          giving margin */         .left-col {             margin-left: 11%;         }          /* Styling the my sound placed          in the left-col */         .left-col h1 {             font-size: 50px;             color: crimson;         }          /* Styling the right-col */         .right-col {             float: right;             margin-right: 10%;             margin-top: -5%;             display: flex;             align-items: center;         }         /* Styling the text in the right-col */         .right-col p {             font-size: 21px;             color: black;             font-weight: 650;             margin-right: 20px;         }         /* Styling the cursor type          of the icon to pointer */         #icon {             cursor: pointer;         }     </style> </head> <body>     <div class="container">         <ul class="nav">             <li><a href="#">CONTACT</a></li>             <li><a href="#">ABOUT</a></li>             <li><a href="#">ARTISTS</a></li>             <li><a href="#">MUSIC</a></li>             <li><a href="#">HOME</a></li>         </ul>     </div>     <div class="content">         <div class="left-col">             <h1>MY <br> SOUNDS</h1>         </div>         <div class="right-col">             <p>Click Here To Listen</p>             <img src="media/play.png" id="icon">         </div>     </div>     <audio id="mysound">         <source src="media/music.mp3" type="audio/mp3">     </audio>     <script>         let mysound = document.getElementById("mysound");         let icon = document.getElementById("icon");         // Creating a function that will change          // pause to play and vice-versa         icon.onclick = function () {             if (mysound.paused) {                 // If paused then play the                  // music and change the image                 mysound.play();                 icon.src = "https://media.geeksforgeeks.org/wp-content/uploads/20210402235545/Pause.png";             } else {                 // If playing then pause the                 // music and change the image                 mysound.pause();                 icon.src = "https://media.geeksforgeeks.org/wp-content/uploads/20210402235520/play.png";             }         }     </script> </body> </html> 

Output:

1
Music Template

I

imsushant12
Improve
Article Tags :
  • JavaScript
  • Web Technologies
  • JavaScript-Projects

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 article, 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 includeA header introducing the ev
    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.Step-by-Step Guide to c
    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