Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7512229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T23:48:01+00:00 2026-05-29T23:48:01+00:00

I recently came across a CSS pseudo class that can do an effect for

  • 0

I recently came across a CSS pseudo class that can do an effect for highlighting a form field, rather than using some custom javascript to do the same thing. Another example is highlighting a table row using CSS rather than javascript.

So my question is: how much faster is it to use CSS than javascript for things like this? Obviously we are talking in general terms, but there probably is a good rule of thumb for it.

I’m thinking this is a new avenue for me to get small performance gains on a page versus other methods I’ve used in the past.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T23:48:02+00:00Added an answer on May 29, 2026 at 11:48 pm

    Any stylistic effect that can be reasonably accomplished in CSS should absolutely be done in CSS rather than javascript. It will almost certainly perform better. The real benefit, though, is that using CSS to style things makes sense. That’s what CSS is for.

    Using javascript to style things that could be styled with CSS doesn’t strike me as being any better than using tables for layout, or deprecated tags like <font> or <center> to get the appearance you desire… it’s an unwelcome hack.

    As for performance, unfortunately this kind of thing is hard to test. Normally you’d do performance testing by doing something over and over as fast as possible in a loop for, say, 5 seconds, and then doing something else as fast as possible for 5 seconds, and then seeing which thing was able to execute the most times in the allotted time. Since there’s no way to automate hovering/unhovering an element without adding a bunch of overhead that would skew test results, it’s difficult to test.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I recently came across some weird looking class that had three constructors: class Class
I recently came across an IE7 only bug that I thought I'd share so
I recently came across a ASP 1.1 web application that put a whole heap
I recently came across a great data structures book, Data Structures Using C (c)
I recently came across a Windows library called AHK that gives me great control
I recently came across the includeMany jQuery plugin to include external JavaScript and CSS
I recently came across a web page using the font ff-tisa-web-pro-1 (specified in their
I recently came across some Java code that simply put some strings into a
I recently came across a rather unusual coding convention wherein the call for a
I recently came across an article by Matthew Weier O'Phinney (ZF project lead) that

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.