Breaking News
Loading...

responsive table code

aa css code head ni niche nakva no 

<style>
* {
  box-sizing: border-box;
}

#myInput {
  background-image: url('/css/searchicon.png');
  background-position: 10px 10px;
  background-repeat: no-repeat;
  width: 100%;
  font-size: 16px;
  padding: 12px 20px 12px 40px;
  border: 1px solid #ddd;
  margin-bottom: 12px;
}

#myTable {
  border-collapse: collapse;
  width: 100%;
  border: 1px solid #ddd;
  font-size: 18px;
  background-color: #15ff0038;
}

#myTable th, #myTable td {
  text-align: left;
  padding: 12px;
}

#myTable tr {
  border-bottom: 1px solid #ddd;
}

#myTable tr.header, #myTable tr:hover {
  background-color: #f1f1f1;
}
</style>

pachi aa tablecode blog ma nakhva no 

<input type="text" id="myInput" onkeyup="myFunction()" placeholder="Search for names.." title="Type in a name">

<table id="myTable">
  <tr class="header">
    <th style="width:60%;">Name</th>
    <th style="width:40%;">Country</th>
  </tr>
  <tr>
    <td>Alfreds Futterkiste</td>
    <td>Germany</td>
  </tr>
  <tr>
    <td>Berglunds snabbkop</td>
    <td>Sweden</td>
  </tr>
  <tr>
    <td>Island Trading</td>
    <td>UK</td>
  </tr>
  <tr>
    <td>Koniglich Essen</td>
    <td>Germany</td>
  </tr>
  <tr>
    <td>Laughing Bacchus Winecellars</td>
    <td>Canada</td>
  </tr>
  <tr>
    <td>Magazzini Alimentari Riuniti</td>
    <td>Italy</td>
  </tr>
  <tr>
    <td>North/South</td>
    <td>UK</td>
  </tr>
  <tr>
    <td>Paris specialites</td>
    <td>France</td>
  </tr>
</table>

<script>
function myFunction() {
  var input, filter, table, tr, td, i, txtValue;
  input = document.getElementById("myInput");
  filter = input.value.toUpperCase();
  table = document.getElementById("myTable");
  tr = table.getElementsByTagName("tr");
  for (i = 0; i < tr.length; i++) {
    td = tr[i].getElementsByTagName("td")[0];
    if (td) {
      txtValue = td.textContent || td.innerText;
      if (txtValue.toUpperCase().indexOf(filter) > -1) {
        tr[i].style.display = "";
      } else {
        tr[i].style.display = "none";
      }
    }       
  }
}
</script>




Name Country
Alfreds Futterkiste Germany
Berglunds snabbkop Sweden
Island Trading UK
Koniglich Essen Germany
Laughing Bacchus Winecellars Canada
Magazzini Alimentari Riuniti Italy
North/South UK
Paris specialites France

Post a Comment

Post a Comment (0)

Previous Post Next Post
/*Reset*/ * { padding: 0; margin: 0; box-sizing: border-box; user-select: none; zoom: 0; } html, body { background-color: #ff1744; height: 70vh; width: 100vw; font-size: 20px; font-family: arial; display: flex; flex-direction: column; align-items: center; justify-content: center; } h1 { margin: 1rem 0; font-size: 1.5rem; } .container { background-color: #ffee58; width: 19rem; border-radius: 0.5rem; } /*User Input*/ .user-input { padding: 0.5rem; } .user-input .form-group { margin: 0.4rem; display: flex; align-items: center; justify-content: space-around; } .user-input .form-group label { color: #333; width: 100px; font-size: 0.7rem; font-weight: bold; } .user-input .form-group input[type="number"] { background-color: #999; width: 115px; height: 31px; text-align: right; font-size: 1.1rem; font-weight: bold; border-radius: 0.2rem; border: none; outline: none; } .user-input .form-group input[type="submit"] { background-color: #00acc1; margin: 0.5rem 0 0 0; padding: 0.1rem 0.2rem; font-weight: bold; font-size: 0.6rem; border-radius: 0.2rem; border: none; outline: none; box-shadow: 2px 2px 5px rgba(0, 0, 0, 0.6); cursor: pointer; } .user-input .form-group input[type="submit"]:active { background-color: red; color: #fff; } .user-input .form-group input[type="submit"]:hover { color: #fff; } /*GST Calculation*/ .GST-Calculation { padding: 0.6rem 0.1rem; display: grid; grid-template-columns: 1fr 1fr 1fr; } .GST-Calculation .form-group { margin: 0 0.1rem; text-align: center; } .GST-Calculation .form-group label { color: #333; font-weight: bold; font-size: 0.6rem; } .GST-Calculation .form-group input[type="number"] { width: 4.2rem; height: 1.4rem; font-weight: bold; font-size: 0.95rem; text-align: center; border-radius: 0.3rem; border: none; outline: none; } /*Buttons*/ .btn-container { padding: 0.9rem 0; display: flex; align-items: center; justify-content: center; } .btn-container button { background-color: #f50057; padding: 0.16rem 0.4rem; margin: 0 0.9rem; border-radius: 0.4rem; font-weight: bold; border: none; outline: none; box-shadow: 2px 2px 5px #000; cursor: pointer; } /*Media Queries*/ @media screen and (max-width: 400px) { .container { width: 15rem; } } @media screen and (max-width: 400px) { .container { width: 12.5rem; } .GST-Calculation .form-group input[type="number"] { width: 3.8rem; } }