The challenge of styling table borders with CSS

Can anyone help me with a problem I'm having while trying to create simple borders on a table? The border appears bold in the second row and last row, does anyone know why this is happening?

https://i.sstatic.net/bCuhK.jpg

Just a note: when I checked back on the W3School tutorial, I noticed that they had the same issue. Could this be a browser problem?

///// My Css code ///////

table{ border-collapse :collapse;}
Table, td { border: 1px solid black;

//// HTML code /////

<table>
  <tr>
    <th>Firstname</th>
    <th>Lastname</th>
  </tr>
  <tr>
    <td>Peter</td>
    <td>Griffin</td>
  </tr>
  <tr>
    <td>Lois</td>
    <td>Griffin</td>
  </tr>
</table>

Answer №1

Your code is all good, it's just a simple and basic one. Have you checked your screen resolution? It might be on the lower side. Try zooming in by pressing "ctrl" + "+" to see if the lines align better.

With different screen resolutions, the thickness of each line is calculated differently. For example, it could be 1.8 pixels - resulting in some lines appearing as 1px and others as 2px due to rounding during rendering.

Answer №2

If your browser zoom is not set to its default 100%, you may experience variations in line widths due to scaling. Adjusting the zoom level back to 100% should resolve this inconsistency.

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

Parsing JSON data into different data types in C#

I am looking for a way to transfer various types of data from JavaScript to C#. Specifically, I want to send a JSON object from the JavaScript side using an AJAX call. Here is an example: AnObject = new Object; AnObject.value = anyValue; $.ajax({ typ ...

Allow checkboxes to function similar to radio buttons within individual rows of a table

I am facing an issue with a table that has multiple rows, each containing one column with three checkboxes. The requirement is for the user to select only one out of the three options in each row. I attempted to solve this using JQuery, but ran into the pr ...

What is the best way to set an initial value retrieved from the useEffect hook into the textField input field?

I am working on an edit page where the initial values of first name, last name, and address are fetched from Firebase Firestore using useEffect. useEffect(() => { const unsubscribe = firestore .collection("users") .doc(uid) ...

Generating RSS Feed on HTML View in Rails 4

I'm currently in the process of building my personal website using Ruby on Rails 4. One challenge I'm facing is trying to scrape Medium.com to display my Medium articles on my page. While the articles are showing up as intended, the RSS code is ...

Guide on how to reload the page with its initial URL after the URL has been modified using history.pushState()

After utilizing history.pushState(), I encountered an issue where the page would refresh with the current URL instead of the original one when the user refreshed the page. I attempted to detect a page refresh using methods such as cookies and hidden field ...

The Ajax submit button is only operational for a single use

Check out my basic HTML form and JS setup: <body> <form> <label for="usrtext">Type your text here:</label> <br /> <textarea name="usrtext" id="usrtext" rows="25" cols="100"></textarea> ...

Numerous features

My goal is to create a program with two functions - one for addition and one for multiplication. For example, if I input 5 and 6, the calculate button should output 11 and 30, respectively. Should I combine both functions into one or keep them separate? An ...

The Javascript validation error for radio buttons briefly appears for a moment when it should stay visible

After reviewing about 30 examples and testing them out, I have decided to post my question since none of the examples seem to be working for me. I am not an expert in JavaScript, but I assumed that validating a simple radio button should not be too diffic ...

What is the best method for pulling in a static, plaintext JSON file into JavaScript through a GET request?

Currently, I am running a test with this specific link: accessing static json data I have encountered several issues with cross-site request errors. It is puzzling to me why it should be any different from loading an image that is hosted on the same site ...

Failure to apply Bootstrap Stylesheet

On certain pages, I have included Bootstrap. On one particular page, I have an alert styled with Bootstrap. This is how it's defined: $('#wrongPasswordDiv').html('<br/><div class="alert alert-danger" id="wrongPWAlert" role= ...

When the width of the element is set to 100vw, it disrupts the

I'm attempting to expand a sticky element to fit the size of the screen. Here is the HTML code I am using: .large { height: 200vw; width: 200vw; } .header { left: 0; top: 0; color:white; position: sticky; width: 100px; height: 10 ...

The function parseArgs in the documentation sample code will throw a type error

import { parseArgs } from 'node:util' const args = [] const options = { t: { type: "string" } } const { values, positionals } = parseArgs({ args, options }) This code snippet is taken directly from the documentation example ...

The alignment of links is not meeting the centering requirement

I'm facing a challenge with aligning my "buttons" on the pages, although they are essentially text links designed to resemble buttons using CSS. These buttons are utilized within an unordered list structure (refer to the HTML snippet below). The rele ...

using node-sass with several different starting points

I am currently working on a project where my main entry point is structure.scss, and each platform has its own second entry point. Here is the folder structure: scss/ | |-- components/ # Modular Component Files | |-- login.scss ...

How can a CSS class be inherited from a different file?

I have defined a class for styling a button: .client-header button { /*Properties*/ } And I also have a class to indicate when the menu is open: .client-menu-open { /*Properties*/ } My goal is to change the background of the button depending on ...

"Although all error messages are functional in Postman, they are not appearing correctly on the frontend client

I am currently developing a website using React and Node. While testing my register and login functionality in Postman, I encountered an issue where the error message for login (e.g., user doesn't exist, username or password incorrect) is not displayi ...

Is there a way to embed a JS media query inside the sticky navbar function for both the onscroll and onclick events?

I've been exploring media queries in JavaScript, and it seems like they work well when the window is resized. However, when nested within onscroll and onclick functions, things start to get a bit tricky. If you run the following code and resize the w ...

Why isn't the default value appearing on page load in jQuery?

I have a set of radio buttons with five different values. For each value selected, a corresponding span tag is generated with a description associated with that specific radio button option. Here's an example: <table class="jshop"> <tbod ...

The functionality of my script relies on the presence of an alert function within it

My code seems to only work when I include an alert function in it. I'm trying to make my div scroll to the bottom. I've done some research, but for some reason, the script doesn't run without an alert function. $(document).ready(function ...

Utilizing Google Web Fonts in Gatsby with Custom Styled Components

While using createGlobalStyle from styled-components for global styling, everything seems to be working fine except for applying Google fonts. I have tried multiple ways but can't seem to get it to work. Here's the code snippet: import { createG ...