HTML Table - vertical line on every occurrence of a <th> tag

Can a continuous vertical line be added to separate each month in a table using CSS when the <th> tag changes? For instance, consider the table below:

What is the best way to insert a vertical line that runs top to bottom between each month through CSS?

Answer №1

It all depends on the HTML structure of your table. Here is a sample code snippet to help you add vertical borders.

table { border-collapse: collapse; }
tr { border: none; }
.line {
  border-left:  solid 1px #000;
}
<table>
  <tr>
    <th colspan="2" class="line">Persons</th>
  </tr>
  <tr>
    <th class="line">Firstname</th>
    <th>Lastname</th>
  </tr>
  <tr>
    <td class="line">James</td>
    <td>Bond</td>
  </tr>
  <tr>
    <td class="line">Clark</td>
    <td>Kent</td>
  </tr>
</table>

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

Utilize the display flex property within a nested flex container

I can't seem to get my link text centered both vertically and horizontally, it keeps aligning to the left. I was under the impression that using flex-based alignments would solve this issue. I have gone through the information on using a flex item as ...

Please refrain from initiating the next action until the previous action has been completed

As a beginner, I am currently working on a photo viewer project using JavaScript and jQuery. My main issue arises when clicking on the arrow to view the next picture. I want the current picture to fade out smoothly before the new one fades in. However, th ...

Submit button failing to fire upon clicking

I have recently started working with AngularJS and I'm facing an issue regarding ng-submit not getting triggered when trying to submit the form. Additionally, I am having trouble accessing $scope.user which is preventing me from posting to the server. ...

My website is experiencing issues with the functionality of the jQuery scroll feature

For a section of my website, I am utilizing jquery scroll functionality. Below is the code I am using within $(document).ready(): var div = $('#wrap'), wrapScreenHeight = div.height(), wrapHeight = div.outerHeight(), listHeight = div ...

Guide on inserting an item into a vertical navigation menu

When it comes to creating a vertical menu, I rely on Bootstrap 5. https://i.sstatic.net/8CWYK.png The issue I'm facing is how to add a black background to the top of the left menu. https://i.sstatic.net/yoEcO.png I am unsure whether I should imple ...

I am having trouble getting the border-radius to display properly in my email table

I'm in the process of designing a responsive email template. For the white content area, I've applied border-radius: 5px;. While it's working fine on the bottom corners of the table, the top corners don't seem to display the border-rad ...

Steps for deactivating a button until the form has been submitted

Click here for the Fiddle and code sample: $(".addtowatchlistform").submit(function(e) { var data = $(this).serialize(); var url = $(this).attr("action"); var form = $(this); // Additional line $.post(url, data, function(data) { try { ...

Make a flexbox item scroll in the cross-axis once it aligns with the size of another element

In my search, I've come across several questions that are somewhat similar but none quite address the exact issue at hand. While this question on Stack Overflow bears some resemblance, I am specifically looking to utilize a flex element instead of a s ...

What steps should I take to address the original tag error for Vue.js in the index.html file?

Desired Learning Interested in delving into the Vue.js framework using Vim and this helpful guide: https://cr-vue.mio3io.com/guide/chapter1.html#繰り返しの描画 Encountered Issue Difficulty in getting Vue tags to be recognized and functional i ...

Exploring Angular 7: Understanding the HTML5 Fullscreen API and Overcoming Errors

I am currently using Angular 7 and I am trying to implement a fullscreen button in my app. I have utilized the HTML5 Fullscreen API and created two functions for this purpose: openfullscreen() { // Trigger fullscreen console.log('gg'); ...

updating the content of a webpage using innerHTML on Squarespace platform

Could anyone help me with changing the status from "sold out" to "coming soon" on this specific page? Below is the code I have tried, but unfortunately, it is not working as expected. window.onload = function() { document.getElementsByClassName("produ ...

How to limit character input in a Div using Angular 2

I need some guidance on Angular 2 with TypeScript. I want to apply a validation rule to a "Div" element where the maximum length should be set to 100 characters. Additionally, even when text is copied and pasted into the Div, it should not exceed 100 chara ...

Using PHP to Showcase Search Results from a Text File on an External HTML Page

I am currently working on building an HTML form in my index.html file that will allow me to search a text file for a specific line of characters using PHP through the searchFile.php file, retrieve that specific line, and display it within the form on the i ...

Best practices for storing and utilizing data collected from an Angular Form

This is the code I have been working on: Here is my component.html: <div class="container"> <Form #a ="ngForm" ngForm (ngSubmit)="onSubmit(a)"> <div *ngFor="let question of questions"> ...

What steps should I take to repair this array table?

I've created a simple array table that uses 3 user-defined values to determine the value of a variable. Although I've written similar code in the past, I'm having trouble figuring out why this one isn't working. The table is quite large ...

Having an issue with Bootstrap icons displaying as blank boxes across all browsers

It seems to be a similar issue to what's discussed here: Glyphicons rendering as empty box Despite my efforts to search for solutions online, I can't figure out what the problem is. It all began when I first started using bootstrap. I've e ...

Tutorial on embedding navigation menu from an external file without using Wamp; all the code should be executed on the client-side

I am trying to find a way to store my top navigation menu in an external file for my static HTML website. I want to be able to easily update the menu and see those changes reflected on all pages without needing to upload them to a server. It's importa ...

The concept of CSS Parent Elements refers to the relationship

Is it possible to dynamically apply CSS style based on the parent property of a div element using JavaScript? Here is an example: <div clas="parent"> <div class="child"> <div class="x"></div> </div> </d ...

Could CSS alone achieve this sub menu position?

Sorry for the lack of clarity in my question, I am struggling to come up with a concise description. I am currently working on creating a drop-down menu using unordered lists, which is structured like this.... <ul id="menu"> <li>Menu Item ...

Tips for prolonging the visibility of the Bootstrap 5 Toast alert

Within my HTML code, I have defined a toast element: <div class="position-fixed top-0 start-50 translate-middle-x" style="z-index: 9999"> <div id="errNeutralAlreadyExists" class="toast fade bg-solid-white&quo ...