Interactive vertical table headers and clickable cells

I am struggling with making cells clickable in a table I created with vertical text headings. The table is meant to document file formats used within our system, where currently only the text link is clickable to lead to the documentation. However, I aim to enhance this functionality so that the entire cell becomes clickable and changes background color when hovered over.

.header {
  width: 100%;
  background-color: White;
  overflow-x: auto;
  _overflow: auto;
}
table.form a {
  color: black;
  width: 100%;
  height: 100%;
  display: inline-block;
  text-decoration: none;
}
table.form a:hover {
  color: SteelBlue;
}
table.form {
  background-color: white;
  border-collapse: collapse;
}
table.form th,
table.form td {
  border: 1px solid black;
  font-weight: normal;
  font-family: Arial, Helvetica, sans-serif;
  font-size: 8px;
  font-weight: normal;
  font-style: normal;
  font-weight: normal;
  min-width: 9px;
}
table.form td {
  width: 9px;
  text-align: center;
}
th:not(.rotate) {
  text-align: left;
}
th.rotate {
  vertical-align: top;
  text-align: center;
}
...
</pre>
<pre><code>...

Answer №1

How to Solve: Remove any additional content from your th element and ensure that it only contains the anchor tag as its child. Then, stretch the anchor tag to fill the entire space of the th, allowing clicking anywhere on the th to function like clicking the a tag as intended.

CSS Code Used:

table.form th:hover { 
  background-color: yellow;
  cursor: pointer;
}
th.rotate > a {
  writing-mode: vertical-rl;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  text-align:left;
}

To change the color of only the th containing links, adjust the selector to

table.form th > a:hover { 

Modify the HTML code from

<th colspan=3 class="rotate">
   <div><span><a href="#formtype">Form type</a></span>
   </div>
  </th>

to

<th colspan=3 class="rotate">
    <a href="#formType">Form type</a>
 </th>

Additionally, note that there is a small typo in the href attribute - it should be corrected to formType instead of formtype.

.header {
  width: 100%;
  background-color: White;
  overflow-x: auto;
  _overflow: auto;
} 

<!-- Other CSS styles here -->

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

python conducting automation tests with Selenium WebDriver on a mouse

Hello, I'm having trouble with opening the Mouser website and using the search bar to send some data. Below is a sample of the code I've been working on, but I can't seem to find the correct CSS selector. Any help would be greatly appreciate ...

Safari 15.6.1 does not support background video playback in Next.js

Currently using Safari version 15.6.1 for a small website project, I have encountered an issue where the video appears frozen with an arrow in the middle. Oddly enough, this problem only occurs on Safari as both Chrome and Firefox display the code correctl ...

"Step-by-step guide on positioning a video in the center over another

I am designing a landing page and I want to incorporate a background video with a centrally aligned logo on top of the video. My goal is for the center of the logo to always align with the center of the background image, regardless of how the page responds ...

Position dropdown elements using absolute alignment

I am attempting to replicate the drop-down menu style used on Twitter. Here is an example of what I am trying to achieve: (Click on the language option). To accomplish this, I have implemented the following HTML: <a href="#language">English</a ...

Creating a Set of Buttons in HTML

Need some assistance with grouped buttons. Let's consider a scenario where there are 5 buttons on an HTML page. When the 3rd button is clicked, buttons from 0 to 3 should change color and the function should return 3. Similarly, when the 5th button is ...

Bootstrap modal experiencing technical difficulties

I am experiencing issues with my bootstrap modal. It seems to be malfunctioning, almost as if the CSS or JavaScript files are not being recognized. I have tried various solutions but have been unable to resolve the problem. I even attempted using the examp ...

Tips for displaying cards with responsive design utilizing Bootstrap 5

How can I display cards responsively for mobile, desktop, and iPad? My goal is to have: - One column for mobile - Two columns for iPad - Four columns for desktop The current code only works for mobile and desktop, not for iPad. On my iPad, it's sh ...

Alignment of Submenus in a CSS Vertical Menu

I'm currently facing an issue with my vertical menu and submenu alignment. Despite everything working correctly, the submenu does not align horizontally as expected, instead shifting up against the header div above it. Any assistance to resolve this w ...

The icons from Font Awesome are not displaying properly in Angular version 15

I have been searching for new information to help solve the error I am experiencing but haven't found any useful results. Here is my issue: I am working on a project in Angular 15.1.0 and want to incorporate some Font Awesome icons. To do this, I foll ...

Is the fixed div not behaving as expected inside a parent with relative positioning?

Seeking help to troubleshoot an issue I'm facing - I have two divs positioned relatively, with child elements positioned fixed within them. As I scroll the page, these two divs are supposed to become fixed to the top of the browser using the following ...

What is the best way to iterate through a subdirectory using Jekyll?

Currently utilizing Jekyll, I've organized my project with a folder named "articles" at the root. Inside this folder, there are two subfolders: "fr" and "eng". My objective is to loop through the "fr" folder on one page and the "eng" folder on anothe ...

Eliminate HTML nodes that are not currently visible

I am currently developing a Vue/Vuetify application that showcases a large number of images (10-20k) in a grid view along with some additional information. These images are grouped into different sections, and clicking on an image opens an overlay displayi ...

Using Google Analytics to monitor open rates and click-through rates of emails

After carefully reviewing the document, I noticed a unique track code that should be able to assist me. However, I am unsure about how to effectively utilize it in order to obtain the open rates and URL click rates. Regarding open rates: I am currently us ...

Ways to prevent the remaining time from indicating the duration

Welcome to my website. If you have any tips on creating dropdowns in markdown, please share! Here is the code snippet: // Add your JavaScript code here This script is designed to play music from a file. To use it, simply click the play button and upload a ...

Side Panel Extending Off Screen Upon Resizing

I'm encountering an issue with the sidebar on my HTML page. The problem arises when I click the 'Upload Data' button, causing the sidebar's header to extend beyond the screen if I resize the window. The only way to fix this is by refres ...

When attempting to call an XML node with JavaScript in an HTML file within Dreamweaver, the functionality works as expected. However, upon testing the same code on a server

As a beginner in Javascript, I am attempting to use document.write to display some XML data in an HTML format. Below is the code that I have been working on: <script> function loadXMLDoc() { if (window.XMLHttpRequest) { xhttp=new XMLHttpRequest( ...

In search of the HTML code for the forward button when extracting content from a webpage

While using Power Automate Desktop to scrape a webpage, I encountered an issue with clicking the next button. Even after copying the HTML code within the developer tools of the webpage, I found that both the previous and next buttons had the same path, mak ...

Adjust the height of the HTML overlay to span the entire visible page

I have a website that utilizes AJAX to load content dynamically. To enhance user experience, I implemented an overlay with a loading indicator during the loading process using jQuery and the jQuery BlockUI plugin. When invoking $(element).block(), everyth ...

Progress Indicators Do Not Move

I have a collection of progress bars that I want to animate. They work fine with maxcdn, but not with local bootstrap references. Can someone please help me figure out what's causing this issue? .resume { width: 816px; margin: 48px 48px 48p ...

Exploring the WPS service URL within OpenLayers 3

I am currently developing a web mapping application and I am looking to generate a WPS service request in URL form using GET method. Similar to how we can create WFS and WMS service URLs, I have successfully executed WPS services such as JTS buffer, lengt ...