Solution 1 :

can you please share the table code structure so that i can check the actual problem please update the complete code

for you understanding i am sharing the proper structure of html table

<!DOCTYPE html>
<html>
<head>
<style>
table {
  font-family: arial, sans-serif;
  border-collapse: collapse;
  width: 100%;
}

td, th {
  border: 1px solid #dddddd;
  text-align: left;
  padding: 8px;
}

tr:nth-child(even) {
  background-color: #dddddd;
}
</style>
</head>
<body>


<table>
  <tr>
    <th><div>Company</div></th>
    <th>Contact</th>
    <th>Country</th>
  </tr>
  <tr>
    <td>Alfreds Futterkiste</td>
    <td>Maria Anders</td>
    <td>Germany</td>
  </tr>
  <tr>
    <td><div>Dummy</div></td>
    <td>Maria Anders</td>
    <td>Germany</td>
  </tr>
  <tr>
    <td>Alfreds Futterkiste</td>
    <td>Maria Anders</td>
    <td>Germany</td>
  </tr>

</table>

</body>
</html>

also it is happen due to this remove this css it will be fine thanks

table th {
top:0;
}

Problem :

Im creating table at first and then i get data with ajax and create td and put a div in it,
but div which is in the td comes over table header throw scrolling.

Table Header Style:

table th {
    background-image: -moz-linear-gradient(top, blue, yellow);
    color: white;
    font-family: 'BRoya';
    font-weight: bold;
    position: sticky;
    top: 0;
    cursor: pointer;
}

As you see div inside of tr comes over table header

enter image description here

Comments

Comment posted by Archer

Obviously cause it’s sticky and top: 0. I think you haven’t tested much to fix it on yourself.

Comment posted by adam johanson

@Archer i cant change because i want to my table headers be fixed in scroll

Comment posted by David Jaw Hpan

Look like you need z-index 1 in th !!!

By