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 4617518
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T02:08:08+00:00 2026-05-22T02:08:08+00:00

update- sorry folks, i should have provided the link to the website where i

  • 0


update-
sorry folks, i should have provided the link to the website where i saw the effect. here you go – http://www.w3schools.com/Css/css_image_transparency.asp

and the code that i saw there (and the basis of this question) is as below –

    <img src="klematis.jpg" style="opacity:0.4;filter:alpha(opacity=40)"
onmouseover="this.style.opacity=1;this.filters.alpha.opacity=100"
onmouseout="this.style.opacity=0.4;this.filters.alpha.opacity=40" />

The original question is as below –

I was looking for rollover effects that can be done without using JS, and i stumbled upon the w3schools website teaching the opacity setting for images. In the code, there is no js involved, its just pure css.

i even tried using the same code into my webpage (which does not have any js, yet) and i noticed that the code happened to work perfectly in both chrome and IE 7.0. the code has a “onmouseover” event and another “onmouseout” event to give the hover effects based on the opacity settings.

wondering whether these effects (onmouseover and onmouseout) are –
1. pure css
2. standards compliant (xhtml 1+ and css2)
3. whether there are any hacks involved

i still cant believe these things worked on ie7, and wondering why there are no documentation on these events.

  • 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-22T02:08:08+00:00Added an answer on May 22, 2026 at 2:08 am

    There’s no such “onmouseover” event or attribute in CSS, that’s JavaScript. CSS uses the “:hover” pseudo-class for mouse over events. A quick example,

    HTML:

    <div id="someid">I'm a random div.</div>
    

    CSS:

    #someid {
        background: #fff;
    }
    
    #someid:hover {
        background: #000;
    }
    

    In this example, when you hover over the #someid element, it’s background will change from white to black.

    This is the correct way to handle mouse over events in CSS. It is standards compliant and will work in all modern browsers (and some older browsers too).

    Sidenote: It won’t always work in IE6, IE6 only recognizes the “:hover” pseudo-class when it’s applied to anchor tags (“a:hover”, etc).

    Based on the update to your question:

    <img src="klematis.jpg" style="opacity:0.4;filter:alpha(opacity=40)"
    onmouseover="this.style.opacity=1;this.filters.alpha.opacity=100"
    onmouseout="this.style.opacity=0.4;this.filters.alpha.opacity=40" />
    

    That is using JavaScript to change the style. The only bit of this which is CSS is the style='...' part. The text in onmouseover and onmouseout is JavaScript.

    To do what you want in pure CSS, it should be like this,

    <html>
    <head>
        <style>
        img.opacity-image {
            opacity: 0.4;
            filter:alpha(opacity=40); /* This is IE specific and NOT standards complaint */
        }
    
        img.opacity-image:hover {
            opacity: 1;
            filter:alpha(opacity=100); /* Again, 'filter:' is IE specific. */
        }
        </style>
    </head>
    <body>
        ...
        <img src="klematis.jpg" class="opacity-image" />
        ....
    </body>
    </html>
    

    opacity is CSS3 and only supported by modern browsers (IE6,7,8 don’t support it). You can use filter:... to get opacity to work in IE (although it won’t handle PNGs correctly, but since you’re using JPG that’s not an issue), but then your code isn’t technically standards compliant as “filter” is not in the CSS standard. That doesn’t generally matter too much though since it’ll still render correctly in any modern browser.

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

Sidebar

Related Questions

Is there any way to do this? Update: Sorry, I should have included more
UPDATE: sorry my IE 9 was'nt configured well: it should've been set so that
UPDATE Turns out I'm just tired. There isn't any problem here sorry for wasting
*update: sorry for the vagueness. I have updated the question I am using the
UPDATE: Sorry I seemed to have forgot some things...see bottom of the post for
I want to modify the following query: UPDATE wp_posts SET post_content = REPLACE(post_content, 'http://oldlink.com',
Sorry folks...first post here. Just getting the hang of this site. Thanks for the
UPDATE : sorry for the confusion. table was not my actual tablename, I have
Sorry for the double post, I will update this question if I can't get
update: I mistyped 2 variables...so embarrassing. thanks everyone for the effort! sorry i find

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.