Get a free trial // Grow your CSS skills // Land your dream job

How to change styles on onload=

  • # September 14, 2011 at 1:15 pm

    I know this is a stupid question that I should know, but how do you change two style rules for the same element at one time on onload? I have this, but I want to add opacity:0; to it.

    # September 14, 2011 at 2:22 pm

    That should work.

    It would be better not to mix HTML with javascript like that though. Try this instead:

    # September 14, 2011 at 2:25 pm

    put it into a function

    window.onload = pre_loader;

    function pre_loader() {


    I don’t think IE support opacity though.

    # September 14, 2011 at 2:54 pm

    Thank You!!!!

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

There's a whole bunch of content on CSS-Tricks.

Search for Stuff   •   Browse the Archives

Get the Newsletter ... or get the RSS feed