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:
How to Create a Slider using HTML and CSS?
Next article icon

How to make a Animated Table using HTML and CSS ?

Last Updated : 07 Aug, 2024
Comments
Improve
Suggest changes
Like Article
Like
Report

 Table is an arrangement of data in rows and columns, or possibly in a more complex structure. Tables are widely used in communication, research, and data analysis.

 In this article, we are going to create a Table with animation over its columns. We are going to implement it using HTML and CSS. 

Approach: Step by step implementation:

Step 1: Create Structure of Table using HTML: We will create a table structure using a table tag in HTML. 

HTML
<!DOCTYPE html> <html lang="en">  <head>     <meta charset="UTF-8">     <meta http-equiv="X-UA-Compatible"          content="IE=edge">     <meta name="viewport" content=         "width=device-width, initial-scale=1.0">      <!-- Set title of web page -->     <title>GFG Animated Table</title> </head>  <body>      <!-- Creating the structure of table -->     <table>         <tr>             <!-- Creating heading of table -->             <th>Employee Name</th>             <th>Job Type</th>             <th>Working Hour</th>             <th>Salary</th>         </tr>          <tr>             <!-- Add 1st data to table -->             <td>Peter</td>             <td>Intern</td>             <td>8 Hour</td>             <td>10000 Rs</td>         </tr>          <tr>             <!-- Add 2nd data to table -->             <td>Liza</td>             <td>Employee</td>             <td>10 Hour</td>             <td>30000 Rs</td>         </tr>          <tr>             <!-- Add 3rd data to table -->             <td>John</td>             <td>Employee</td>             <td>10 Hour</td>             <td>35000 Rs</td>         </tr>     </table> </body>  </html> 

Step 2: Decorating Table using CSS: Now, we will apply CSS over the table which we have created earlier.

CSS
/* Set the content of table using css properties */ table {     width: 700px;     margin: auto;     text-align: center;     table-layout: fixed; }  /* Applying css properties to  table components */ table, td, tr {     padding: 12px;     color: wheat;     background: indigo;     border: 1px solid black;     border-collapse: collapse;     font-size: 20px;     font-family: 'Lucida Sans',          'Lucida Sans Regular',          'Lucida Grande',         'Lucida Sans Unicode',          Geneva, Verdana, sans-serif; }  /* Apply css properties to th */ th {     color: white;     border: 1px solid black;     border-collapse: collapse;     background: cadetblue; }  /* Apply hover effect to td */ td:hover {     background: orangered; } 

Complete Code: Complete HTML code is given as an example for your help. Comments are added in the code for better understanding.

HTML
<!DOCTYPE html> <html lang="en">  <head>     <meta charset="UTF-8">     <meta http-equiv="X-UA-Compatible"              content="IE=edge">     <meta name="viewport" content=         "width=device-width, initial-scale=1.0">      <!-- Set title of web page -->     <title>GFG Animated Table</title>      <style>          /* Set the content of table          using css properties */         table {             width: 700px;             margin: auto;             text-align: center;             table-layout: fixed;         }          /* Applying css properties          to table components */         table,         td,         tr {             padding: 12px;             color: wheat;             background: indigo;             border: 1px solid black;             border-collapse: collapse;             font-size: 20px;             font-family: 'Lucida Sans',                  'Lucida Sans Regular',                 'Lucida Grande',                  'Lucida Sans Unicode',                 Geneva, Verdana, sans-serif;         }          /* Apply css properties to th */         th {             color: white;             border: 1px solid black;             border-collapse: collapse;             background: cadetblue;         }          /* Apply hover effect to td */         td:hover {             background: orangered;         }     </style> </head>  <body>      <!-- Creating the structure of table -->     <table>         <tr>             <!-- Creating heading of table -->             <th>Employee Name</th>             <th>Job Type</th>             <th>Working Hour</th>             <th>Salary</th>         </tr>                  <tr>             <!-- Add 1st data to table -->             <td>Peter</td>             <td>Intern</td>             <td>8 Hour</td>             <td>10000 Rs</td>         </tr>                  <tr>             <!-- Add 2nd data to table -->             <td>Liza</td>             <td>Employee</td>             <td>10 Hour</td>             <td>30000 Rs</td>         </tr>          <tr>             <!-- Add 3rd data to table -->             <td>John</td>             <td>Employee</td>             <td>10 Hour</td>             <td>35000 Rs</td>         </tr>     </table> </body>  </html> 

Output:


Next Article
How to Create a Slider using HTML and CSS?

R

riyamathur
Improve
Article Tags :
  • Web Technologies
  • Web Templates

Similar Reads

  • How to Create Pricing Table using HTML and CSS ?
    Nowadays, every website contains pricing tables, such as e-commerce, e-tech, and even tourism websites also have pricing tables as they contain their plans, cost of plans, and information about plans to buy new facilities. So the pricing table is one of the most important parts of websites that sell
    3 min read
  • How to Create a Slider using HTML and CSS?
    A slider (also called a slideshow) is a sequence of content frames that users can navigate through. Creating a slider using just HTML and CSS is efficient because it doesn't require JavaScript, making it lightweight and fast. The slider can contain images, text, or any other content you want to show
    3 min read
  • How to Create an Animated Search Box using HTML and CSS ?
    The task is to create an Animated Search Box using HTML and CSS. The search bar is one of the most important components of the website. Basically, it is used for connecting people with websites. In the face of complicated web content, users express their needs by searching keywords, expecting to obt
    2 min read
  • How to Create Image Accordion using HTML and CSS ?
    In this article, we will see how to create an image accordion using HTML & CSS that is basically used for advertising purposes on e-commerce websites. An Accordion is often used to open multiple sections at full width & also content pushes the page content downward. Approach:Create an HTML f
    3 min read
  • How to create Animated bars using HTML and CSS?
    Dancing bars are one of the classical components that are used in making a good looking website. They are very simple to implement and can be used as a loader or an animation while recording sound. Approach: The approach is to use unordered list to create bars and then animate them using keyframes.
    2 min read
  • How to create a animated pill shaped button using HTML and CSS ?
    Most mobile applications and websites have some eye-catching animation that tries to grab the attention of the user, these animations trigger some event fire or on an infinite loop, website events are triggered on mouse clicks or mouse hovers while on mobile touch events or infinite loop is activate
    4 min read
  • How to create a table row using HTML?
    Define a row in a table by using a <tr> tag in a document. This tag is used to define a row in an HTML table. The tr element contains multiple th or td elements. Syntax:<tr> ... </tr>Example: In this example, a table row in HTML5, utilizes the <tr> tag within the <tbody
    1 min read
  • How to create Image Stack Illusion using HTML and CSS ?
    In this article, we are going to create an illusion of images below the main image. It is the same as the image set of the gallery in an older version of Android. This is a simple project, we can achieve our target only by using HTML AND CSS. Overview of the project: Approach: Create a main div in w
    4 min read
  • How to Create Text Color Animation using HTML and CSS ?
    The text color can be changed according to the programmer’s choice using CSS @keyframes rule. In this article, we will see how to create text color animation using HTML and CSS. Preview:Approach:Create an HTML file with a centered <div> containing an <h2> element.Use CSS to reset default
    1 min read
  • How to Use Icons to Make an Animated Effect Using CSS?
    Icons are small, visual representations of actions or content. They can add a lot of style and functionality to a website, especially when combined with animations. we'll explore how to use CSS to animate icons, giving your website a lively and interactive touch. These are the following approaches f
    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