Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Jan 2008
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    rollover images in divs

    Hi,
    Im brand new to css and I building a small site to teach my self.

    I have 2 problems hindering my progress and I think they may be related.

    First off is my problem with rollover buttons for navigation. (might belong in the javascript forum)

    I have four images that I am using as button. These buttons are contained in a div tag inside of a header div.

    If I rollover a button, instead of seeing its over state the buttons flicker, disappear and swap positions!!! I'm very new to this and am bewildered.


    //*********** javascript in head*******//

    <SCRIPT LANGUAGE="JavaScript">

    <!-- Begin
    <head>
    image1 = new Image();
    image1.src = "BUTTONS/home_over.png";

    image2 = new Image();
    image2.src = "BUTTONS/services_over.png";

    image3 = new Image();
    image3.src = "BUTTONS/portfolio_over.png";

    image4 = new Image();
    image4.src = "BUTTONS/contact_over.png";

    // End -->
    </script>
    </head>

    ********** the div tag html*****************
    <div id="top">
    <div id="logo"> </div>
    <div id="nav">

    <a href="index.html" onmouseover="image1.src='images/BUTTONS/home_over.png';"
    onmouseout="image1.src='BUTTONS/home.png';">
    <img name="image1" src="BUTTONS/home.png" border=0></a>

    <a href="services.html" onmouseover="image2.src='images/BUTTONS/services_over.png';"
    onmouseout="image2.src='BUTTONS/services.png';">
    <img name="image2" src="BUTTONS/services.png" border=0></a>

    <a href="portfolio.html" onmouseover="image3.src='images/BUTTONS/portfolio_over.png';"
    onmouseout="image3.src='BUTTONS/portfolio.png';">
    <img name="image3" src="BUTTONS/portfolio.png" border=0></a>

    <a href="contact.html" onmouseover="image4.src='images/BUTTONS/contact_over.png';"
    onmouseout="image4.src='BUTTONS/contact.png';">
    <img name="image4" src="BUTTONS/contact.png" border=0></a></div>
    </div>

    ********** the css class*************

    #nav{
    position:relative;
    left:500px;
    width:380;
    heigth:58;
    }

    **********************************

    The java script was generated free online so I expected it to "just work".


    Because it doesn't I started thinking it had something to do with the div that the images were in. Maybe each image needs a different div??

    My main concern about these navigation buttons in the header is fluidity. I have a floating content box on the right hand side of the screen. I really want the site to shrink together when a screen is minimized. This works fine for the content box but Im not sure how or if its possible to achieve with these buttons i'm using.

    The code I posted probably looks horrific, but I only really started a couple of days ago.

    Any advice or tips are really really welcome.

    P.s.... I attached a zip file containing my files. Its just a single html page and a css file and a few images. (please dont laugh if you look at it!!!)

    Thanks
    -dub
    Attached Files Attached Files

  • #2
    New to the CF scene
    Join Date
    Jan 2008
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    sorry

    please ignore the previously attached zip file. Its the wrong one. I have attached the right one here
    Attached Files Attached Files

  • #3
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,675
    Thanks
    22
    Thanked 1,827 Times in 1,811 Posts
    Hello dubbeat,
    I'm not a big fan of js menus or rollovers. Have a look at a couple CSS only examples I have. Look at the source and the images to see how it's done.
    one
    two
    three
    Validate often DURING development - Use it like a splelchecker | Debug during Development |Write it for FireFox, ignore IE
    Use the right DocType | Validate your markup | Validate your CSS | Why validating is good | Why tables are bad

  • #4
    New to the CF scene
    Join Date
    Jan 2008
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts
    working examples to study are cool!
    I'll take a look,

    Thanks!!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •