Is there a solution or workaround for the issue of fake anti-aliasing in Microsoft Edge when it comes to the border of sticky headers using Bootstrap 4?

In my current project, I came across a Pen shared by Balaji731 on Bootstrap 4 table with the scrollable body and header fixed.

While testing the Pen in Microsoft Edge, I noticed that when <th> borders are enabled, they disappear while scrolling, creating a visual gap and rendering issues with the thead contents.

To address this, I temporarily set border: 0; on the <th> elements, which is not an ideal solution. I am seeking advice on a better approach to resolve this issue. Any suggestions?

<div class="table-responsive">
<table class="table table-hover" id="job-table">
 <thead>
  <tr class="text-center">
   <th scope="col">Sr.No.</th>
   <th scope="col">Company Name</th>
   <th scope="col">Technology</th>
   <th scope="col">Total Resumes</th>
   <th scope="col">Job Title</th>
   <th scope="col">Total Score</th>
   <th scope="col">Average Score</th>
  </tr>
 </thead>
 <tbody>
  <tr key={key}>
   <td class="font-weight-bold">1</td>
   <td class="font-weight-bold">ABCDED</td>
   <td>Software Developer</td>
   <td class="font-weight-bold">17</td>
   <td>5 years experience</td>
   <td class="font-weight-bold">30</td>
   <td class="font-weight-bold">30</td>
  </tr>
   <tr key={key}>
    <td class="font-weight-bold">1</td>
    <td class="font-weight-bold">ABCDED</td>
    <td>Software Developer</td>
    <td class="font-weight-bold">17</td>
    <td>5 years experience</td>
    <td class="font-weight-bold">30</td>
    <td class="font-weight-bold">30</td>
   </tr>
  </tbody>
</table>

Here's the CSS:

.table-responsive{
  height:400px;  
  overflow:scroll;
}
thead tr:nth-child(1) th{
  background: white;
  position: sticky;
  top: 0;
  z-index: 10;
}

Screenshot of Microsoft Edge issue

Answer №1

Is the issue with the bottom line of the Table heading, which appears thin in the MS Edge browser?

Shown in the Chrome browser snapshot:

https://i.sstatic.net/pgA3U.png

If you would like a similar appearance in MS Edge, you can add the following style to your TH tag:

border-bottom: 4px solid lightgray;

Updated code example:

<!doctype html>
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<style>
.table-responsive{
  height:400px;  
  overflow:scroll;
}
 thead tr:nth-child(1) th{
    background: white;
    position: sticky;
    top: 0;
    z-index: 10;
    border-bottom: 4px solid lightgray;
        
  }
</style>
</head>
<body>
<div class="table-responsive">
    <table class="table table-hover" id="job-table">
      <thead>
        <tr class="text-center">
          <th scope="col">Sr.No.</th>
          <th scope="col">Company Name</th>
          <th scope="col">Technology</th>
          <th scope="col">Total Resumes</th>
          <th scope="col">Job Title</th>
          <th scope="col">Total Score</th>
          <th scope="col">Average Score</th>
        </tr>
      </thead>
      <tbody class="text-center tableBody">
            <tr key={key}>
              <td class="font-weight-bold">1</td>
              <td class="font-weight-bold">ABCDED</td>
              <td>Software Developer</td>
              <td class="font-weight-bold">17</td>
              <td>5 years experience</td>
              <td class="font-weight-bold">30</td>
              <td class="font-weight-bold">30</td>
            </tr>
            <!-- additional table rows here -->
        </tbody>
    </table>
  </div>
</body>
</html>

Displayed in MS Edge browser:

https://i.sstatic.net/UDPom.png

If I misinterpreted anything, please let me know so I can make necessary corrections.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Ways to update the UI dynamically in Angular without the need to refresh the entire page

On my page, I have multiple charts and I'm facing an issue where the chart UI does not update immediately when I try to make a delete call by clicking the delete button. I always have to refresh the browser to see the changes. I have provided the ful ...

The select dropdown default choice is not appearing as expected

My template is not showing the default select option that I have set for one select element. I attempted to achieve this with the following code: <div class="select"> <select (change)="calculaMes(mesEscolhido)" [(ngModel)]="mesEscolhido" na ...

Images in a separate css class will cause other images to move as well

I'm currently facing an issue in my React project where adding padding to some images at the bottom of the page in a separate CSS class is causing the main image at the top of the page to move. Main Image <div className="self--image& ...

When the *ngFor directive disrupts the CSS Grid Layout, resulting in all items being displayed in a single column

I am a beginner in the world of programming and web development. Currently, I am working on building my own personal website. My goal is to arrange boxes in a grid with 4 columns, similar to the layout you can find at this link: Each box represents an ob ...

Is it possible for a memory leak to occur when a jQuery object is created within a function but never actually used?

As an illustration: function calculateTime(minutes) { var newTime = new Date(); newTime.setHours(0, minutes, 0, 0); return angular.element('<input type="hidden"/>').timepicker('setTime', newTime).val(); } I'm cu ...

Create a duplicate of a div element, including all of its nested elements and associated events, using

Attempting to duplicate a div containing input fields but the event listeners are not functioning. Despite performing a deep copy in the following manner - let rows = document.querySelectorAll('.row'); let dupNode = rows[0].cloneNode(true); sh ...

I would like some clarification on how bookmarking works

As I encountered a puzzling issue recently, I realize that I may need some assistance to navigate through it. It involves bookmarking some links for future reference. I attempted to search for answers online but found myself even more perplexed. Does boo ...

Spinning with animation in jQuery

Greetings! I am in the process of creating a popup box that will appear upon clicking the Login button. My aim is to produce a popup box with a rotating effect, however, my attempts have not been successful so far. You can view the code snippet on JsFidd ...

Replacing the CSS Reset with the Universal Selector

I implemented Eric Meyer's Reset to set the font, and then loaded my stylesheet to globally set the font using the universal selector. Even though I loaded the universal selector in my SASS after the reset, the reset is still taking precedence. (Atta ...

The z-index property does not seem to function properly when used in conjunction

I am experiencing an issue with the z-indexes of two divs: one with default positioning and the other with a fixed position. No matter how I adjust the z-index values, it appears impossible to make the fixed-positioned element go behind the statically pos ...

Customizing div elements in various RMarkdown documents with a CSS file

I want to apply styling to divs in various RMarkdown files using a CSS file. However, I am encountering syntax issues when trying to use the external CSS file to style the div. Embedding the style tag within the rmarkdown body works as shown below: --- ti ...

Foundation 5 - ensure background-image covers the entire column width

I'm trying to achieve a unique layout using Zurb Foundation. My goal is to have two columns, each taking up half of the screen: <div class="small-6 columns"><!-- INSERT IMAGE HERE --></div> <div class="small-6 columns"> < ...

Adjusting the size of the entire webpage using Bootstrap 5

My webpage is built using Bootstrap 5 and overall, I am pleased with how it looks. However, I'm finding that all the body elements are too large. View Elements too large The elements at the bottom of the page are getting cut off and I want the entir ...

Updating the ID's of nested elements in JavaScript when duplicating an element

After a fruitless search on Google, I have turned to the experts on SO for assistance. The challenge: Create a duplicate of a dropdown menu and an input field with the click of a button (which can be done multiple times) The proposed solution: Implement ...

Tips on accessing the v-model value with a parameter in VUE

Looking to access the v-model value using a parameter, I attempted the following code: <template> <div v-for="(item, idx) in data"> <input :id="item" :v-model="item"></input> <button @click=&q ...

Personalize Dropdown Menu, determining when to initiate the hide menu action

When creating a dropdown using ul and li tags, I am faced with the dilemma of determining the ideal time to hide the dropdown menu. The dropdown menu is designed to display values based on user input as they type, updating dynamically. Initially, I had se ...

"Is there a way to transfer a value from one list box to another without needing to refresh the page, by utilizing AJAX,

Is there a way to automatically load Related Course levels in the Course Level Listbox when selecting a Course from the Course list? <script type="text/javascript" src="js/jquery.js"></script> <div>Course:<select name="course_id" id= ...

Creating personalized checkboxes

Trying to create custom checkboxes for different colors like red, blue, etc... https://i.sstatic.net/IKqJH.jpg Struggling to achieve the desired outcome Utilizing Bootstrap 5.3: Attempting to learn by dissecting a bootstrap template with the desired res ...

The v-for in Vue is not displaying the accurate text in the modal window and is only showing the data for the first item

In the process of learning Vue and Bootstrap, I am creating a blog where I want a modal window to pop up with the post information when the user clicks on the comment button. However, the issue I'm facing is that the modal only displays information fr ...

Manipulate the timing of css animations using javascript

I am currently working with a progress bar that I need to manipulate using JavaScript. The demo of the progress bar has a smooth animation, but when I try to adjust its width using jQuery $($0).css({'width': '80%'}), the animation disap ...