Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Highlight table TD / Column

Featured Replies

Yes - you just need a javascript listener.

Each column will have it's own ID/class. The listener checks which option is selected and changes the CSS for the selected option using the ID/class.

However. I wouldn't use a table for this as it won't work on a phone (which is the device many use).

The other alternative is to make the whole column a radio button. You wouldn't be able to have the full width headings but you would be able to just use something like:

.options {display: grid;
	grid-template-columns: 32% 32% 32;
	grid-gap: 2%;
}
.options input[type="radio"] {
  opacity: 0;
  position: fixed;
  width: 0;
}
.options label {
	display: inline-block;
	text-align: center;
	line-height: 30px;
	font-size: 12px;
	font-weight: 900;
	background-color:#cce6ff;
	color: #164C81;
	cursor: pointer;
}
.options label:hover, .button input[type="radio"]:checked + label {background-color:#164C81;color:#FFFFFF;}

 

If the input element is a direct child of the wrapping div, then there's no need for any javascript or complex css rules, you can just target it using the :has() modifier

Just quickly did this in a couple of minutes as an example (May need to copy the link into a new tab) https://codepen.io/jpeters8889/pen/yyLLOwW

  • Author

If I bin the table can I still have the full width heading in between benefits? 

Happy to try anything, and appreciate all the help and advice.

I saw jpeters8889 was using the :has

Edited by Waynede1986

18 minutes ago, Waynede1986 said:

If I bin the table can I still have the full width heading in between benefits?

Probably not.

But you really don't want to use tables. The main reason being it won't fit on a phone.

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.