Highlight Table Row using CSS
You can use CSS without any javascript to make the row of a table highlight on hover. All it requires is that the use the pseudo class :hover to add the effect to whatever html element you choose.
In this case we would add it to a table row using a stylesheet rule as in this CSS code example below:
tr:hover {
background-color: #ffff99;
}
The rule above will apply to every row on every table on your site and so you probably want to use a class or ID to limit this effect to tables that you specifically choose which is what we'll do in the following example.
An Example of Table Row Highlighting on Hover
Here we have a working example of a table that highlights rows on hover that just uses CSS to achieve this effect. Just mouseover the table to see the effect in action.
Text 1A | Text 1B | Text 1C |
Text 2A | Text 2B | Text 2C |
Text 3A | Text 3B | Text 3C |
The CSS Table Code
Copy the required CSS and HTML Code for this Table from the box below:
Browser Support
Browser support for the :hover pseudo class on all applicable elements (in other words not just on links) is pretty solid for all modern browsers.
As always the question comes down to Internet Explorer and its support for once is surprisingly quite good here on older version of Internet Explorer. IE 7 and up will support the general use of the hover effect with one caveat.
The html page must have a <!DOCTYPE> on it. If it does not have a doctype then the hover effect will not work in pretty much all versions of IE. It's a small issue but it may be of consequence if you're stuck developing on a fairly inflexible system and you need to work on a page without a doctype.
Most Popular Text Tools
- Remove Line Breaks: Remove unwanted line breaks from your text.
- Random Word Generator: Generate a list of random words. Great tool for brainstorming ideas.
- Alphabetical Order: Alphabetize all sorts of text content with this tool.
- Text to HTML: Automatically change plain text into HTML paragraphs.
- HTML to Text: Remove all HTML tags, leaving only text content.
- Word to HTML: Convert a Word document into clean HTML code.
- Online Sentence Counter: Quickly count the number of sentences in your content.
- Random Choice Generator: Randomly pick a choice from a list of options.
- Reverse Text Generator: Create social media posts or any text in reverse text.
- Remove Duplicate Lines: Remove all of the identical lines in your content.
- Paragraph to Single Line: Convert any multiple paragraphs to a single line.
Alphabetical Tools
Random Generators
- Random Word Generator
- Random Sentence Generator
- Random Noun Generator
- Random Adjectives Generator
- Random String Generator
- Random Letter Generator
- Random Decision Maker
- Random Number Generator
- Random Password Generator
- Random Choice Generator
Line Break Tools
Fun Text Tools
- Reverse Text
- Fake Word Generator
- Repeat Text Generator
- Tiny Text Generator
- Cursive Text Generator
- Bold Text Generator
Text Changing Tools
- Find and Replace Online
- Capitalize the First letter of Sentences
- Uppercase or Lowercase Text
- Remove Spaces Online
- Replace Tabs with Spaces
- Capitalize Each Word
- Remove Numbers from Text
SEO and Word Tools
- Word Counter
- Sentence Counter Online
- Character Counter
- Title Capitalization Tool
- Meta Description Length Checker
Content Conversion Tools
- Convert a Word Doc to HTML
- Convert Word Doc to Text
- Convert Plain Text to HTML
- Convert Email to HTML
- Convert URLs to HTML Links
- Convert CSV Text to HTML Table
- HTML to Text
HTML Code Generators
- HTML Table Generator
- HTML List Generator
- HTML Text Generator
- Javascript Pop-up Window Maker
- Mailto Link Generator
- Remove HTML Tags