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 2 of 2
  1. #1
    New Coder
    Join Date
    Feb 2005
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    getting text under a rollover image with css

    Hi

    Please help me with this, I can't seem to get it right. I did try using one image then only displaying half of it, but couldn't get it to work. So abandoned it for this.
    I am trying to get some text under an image in a navbar. The images change on mouseover, but I cannot get the text underneath. Using dreamweaver everything looks OK, but after I uploaded it all went pear shaped.

    Code:
    #navbar li {
    list-style: none;
    display: inline;
    height: 20px;
    clear: both;
    padding: 8px 20px 2px 20px;
    }
    
    #navbar img {
    
    display: inline;
    Code:
    <div id="navbar">
    <ul>
    <!-- This is the rollover section for the navigation menu.-->
    <li><a href="index.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('bottle','','images/glassesNew.gif',1)"><img src="images/bottle.gif" name="bottle" width="50" height="53" border="0">Home</a></li>
    <li><a href="details.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('details','','images/glassesNew.gif',1)"><img src="images/bottle.gif" name="details" width="50" height="53" border="0"></a><a href="#">Details</a></li>
    <li><a href="attendants.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('attendants','','images/glassesNew.gif',1)"><img src="images/bottle.gif" name="attendants" width="50" height="53" border="0"></a><a href="#">Attendants</a></li>
    <li><a href="travel.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('travel','','images/glassesNew.gif',1)"><img src="images/bottle.gif" name="travel" width="50" height="53" border="0"></a><a href="#">Travel</a></li>
    <li><a href="registry.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('registry','','images/glassesNew.gif',1)"><img src="images/bottle.gif" name="registry" width="50" height="53" border="0"></a><a href="#">Registry</a></li>
    <li><a href="photos.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('photos','','images/glassesNew.gif',1)"><img src="images/bottle.gif" name="photos" width="50" height="53" border="0"></a><a href="#">Photos</a></li>
    <li><a href="places.htm" onMouseOut="MM_swapImgRestore()" onMouseOver="MM_swapImage('places','','images/glassesNew.gif',1)"><img src="images/bottle.gif" name="places" width="50" height="53" border="0"><a href="#">RSVP</a></li>
    </ul>
    </div>
    When I initially checked the page in the browser when in Dreamweaver, it looked fine and my css #navbar img was set to 'block'. Yet when I uploaded the page the navbar images were one on top of the other. I changed my #navbar img to 'inline' and it does put them all along one line, but the images are next to the text, not above it.

    Can anyone help please. Smiling
    Here is the page url

    http://www.our-perfect-day.co.uk/CC/index.htm
    Thanks in advance.
    Harlequeen


    bringing colour to a dull world

  • #2
    Master Coder Excavator's Avatar
    Join Date
    Dec 2006
    Location
    Alaska
    Posts
    9,737
    Thanks
    22
    Thanked 1,836 Times in 1,820 Posts
    Code:
    #navbar {
    height: 95px;
    overflow: hidden;
    }
    #navbar ul {
    }
    #navbar li {
    	list-style: none;
    text-decoration: none;
    float: left;
    	height: 20px;
    }
    #navbar a {
    text-decoration: none;
    }
    
    #navbar img {
    
    	display: inline;
    }
    Code:
    <li><a href="index.htm" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('bottle','','images/glassesNew.gif',1)"><img src="http://www.our-perfect-day.co.uk/CC/images/bottle.gif" name="bottle" border="0" height="53" width="50"> </br>Home</a></li>
    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


  •  

    Posting Permissions

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