Jump to content

[SOLVED] Inefficient uses of :hover in CSS?


random1

Recommended Posts

I'm making my web app skinny, optimized.

 

For CSS I'm testing using Google Page Speed,

 

Results:

 

stylesheet.css has 0 very inefficient rules, 0 inefficient rules, and 7 potentially inefficient uses of :hover out of 199 total rules.

Rules that use the :hover pseudo-selector on non-anchor elements. This can cause performance problems in Internet Explorer versions 7 and 8 when a strict doctype is used.

        * select:hover
        * textarea:hover
        * input[type="text"]:hover
        * input[type="password"]:hover
        * select:hover
        * .topbarfield:hover
        * .userprofileselect:hover

 

How can this be resolved? Any ideas? I'm using XHTML 1.0 Strict as a DOCTYPE.

Link to comment
Share on other sites

They can be resolved by not using :hovers, but that's not so practical. Seven hovers is not much of a drain at all though.

 

But out of curiosity, why are you putting hover on those elements? They aren't elements that would traditionally be hovered, though I can think of some reasons you may want to. But I'm curious about your usage.

Link to comment
Share on other sites

        * select:hover

        * textarea:hover

        * input[type=text]:hover

        * input[type=password]:hover

        * select:hover

        * .topbarfield:hover

        * .userprofileselect:hover

 

The main reason I'm using :hover on these elements is because I want to show state and position on input elements.

 

For example you hover over a field the background colour changes and cursor so that you can easily tell which form field you are on (or have focus on). That kinda thing.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.