How to make Responsive Table Using HTML and CSS.[Source Code]
To make this website, you would like to make two files: an HTML file, a CSS file. First, create an HTML file with the name of index.html and remember, you have to create a file with a .html extension.
/** 
Hello Future Developer Thanks for Using learningrobo.com, 
Check our website Regularly For New Snippets Post.
Share & Support us
**/
*{
    box-sizing: border-box;
}
body{
    margin:0px;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
.container{
    width:100%;
    min-height:100vh;
    max-height:fit-content;
    display:flex;
    justify-content:center;
    flex-direction: column;
    align-items:center;
    background-color:#00576B;
}
.box{
    background-color:#012C3C;
    width: 850px;
    height: 500px;
    margin: 110px auto;
}
table,th,td{
    border: none;
    border-collapse: collapse;
}
table{
    width: 850px;
    height: 500px;
    font-size: 18px;
    color:#ffff;
}
th{
    background-color:#012C3C;
    color: rgb(209, 209, 13);
    padding-left: 10px;
    text-align: left;
}
td{
    padding-left: 10px;
}
tr:nth-child(even){
    background-color: #05425895;
}
tr:hover{
    background-color:rgba(84, 152, 167, 0.324);
    transition:.5s;
}
@media screen and (max-width:1024px){
    .box{
        width:85%;
        height:fit-content;
    }
    table{
        width: 100%;
        height: 500px;
    }
}
@media only screen and (max-width: 630px){
    .box{
        margin:10px 0px;
        width:95%;
        height:fit-content;
    }
    table{
        width: 100%;
        height: 500px;
    }
    .box th{
        display: none;
    }
    .box td{
        display:grid;
        grid-template-columns:15ch auto;
        text-align: left;
        padding:5px;
        margin:5px;
        border:none;
    }
    .box td:nth-of-type(1)::before{
        content: "ID" " :";
    }
    .box td:nth-of-type(2)::before{
        content: "First Name" " :";
    }
    .box td:nth-of-type(3)::before{
        content: "Designation" " :";
    }
    .box td:nth-of-type(4)::before{
        content: "Gender" " :";
    }
    .box td:nth-of-type(5)::before{
        content: "Salary" " :";
    }
    .box td:nth-of-type(6)::before{
        content: "Alive" " :";
    }
}
.credit a{
    text-decoration: none;
    color: #ffff;
    font-weight: 800;
}
.credit{
    color: #ffff;
    text-align: center;
    margin-top: 10px;
    font-family: Verdana,Geneva,Tahoma,sans-serif;
}
.credit span{
    color:tomato;
    font-size:20px;
}
Thank you for reading our blog. If you face any problem in Creating a Responsive Table Using HTML and CSS., then contact us or comment to us. We’ll try to provide a solution to your problem as soon as possible.
Explore
    Press The Key ' p ' and say ' read article ' our voice assistant read our article.
In Our older post it doesnot work we working on that.
In Our older post it doesnot work we working on that.
 

Post a Comment
Thank you
Learning robo team