www.webdeveloper.com
Recent Articles
  • Finding Slow Running Queries in ASE 15
  • A More Advanced Pie Chart for Analysis Services Data
  • Adobe AIR Programming Unleashed: Working with Windows
  • Performance Testing SQL Server 2008's Change Data Capture Functionality
  • The ABC's of PHP: Introduction to PHP
  • How to Migrate from BasicFiles to SecureFiles Storage
  • Why the Twitter Haters Are Wrong
  • User Personalization with PHP: Beginning the Application
  • Whats in an Oracle Schema?
  • Lighting Enhancement in Photoshop
  •  

    Go Back   WebDeveloper.com > Client-Side Development > CSS

    CSS Discussion and technical support relating to Cascading Style Sheets.

    Reply
     
    Thread Tools Search this Thread Rate Thread Display Modes
      #1  
    Old 11-06-2009, 10:01 PM
    JMRKER JMRKER is offline
    Registered User
     
    Join Date: Dec 2005
    Location: FL
    Posts: 4,261
    Question Align images to bottom of container.

    In the following script, I have used a table to make the images align to the bottom of the table border where the image grow UP when moused over.

    How do I accomplish the same thing with CSS in the 'Container'?
    I want the images to be initially lined up along the bottom and then 'grow' when moused over.

    I cannot figure how to set the bottom of the image to the bottom of the "Container".

    Code:
    <html>
    <head>
    <title>Roll-over image enlarger</title>
    
    <style type="text/css">
    #Container { height:200px; width:400px; border:1px solid blue; }
    #pic1, #pic2, #Cpic1, #Cpic2 { height:125px; width:100px; bottom-margin:0px; }
    
    </style>
    
    <script type='text/javascript'>
    // From: http://www.dreamincode.net/forums/showtopic136650.htm
    
    var oheight = 125;
    var owidth = 100;
    var nheight = Math.floor(oheight*3/2);  // scaling factor of 1.5
    var nwidth = Math.floor(owidth*3/2);
    
    function popImg(open,pic) {
      if (open) {
    	  document.getElementById(pic).style.height = nheight+'px';
    	  document.getElementById(pic).style.width = nwidth+'px';
      } else {
    	  document.getElementById(pic).style.height = oheight+'px';
    	  document.getElementById(pic).style.width = owidth+'px';
      }
    }
    
    </script>
    </head>
    <body>
    <!-- One method that works -->
    <table border="1"><tr><td valign="bottom" height="200" width="400">
     <img src="http://www.nova.edu/~rumsey/snoopy.gif" id="pic1"
      onmouseover="popImg(true,this.id);" onmouseout="popImg(false,this.id);">
     <img src="http://www.nova.edu/~rumsey/BanjBird.GIF" id="pic2"
      onmouseover="popImg(true,this.id);" onmouseout="popImg(false,this.id);">
    </td></tr></table>
    <!-- -->
    
    <div id="Container">
     <img src="http://www.nova.edu/~rumsey/snoopy.gif" id="Cpic1"
      onmouseover="popImg(true,this.id);" onmouseout="popImg(false,this.id);">
     <img src="http://www.nova.edu/~rumsey/BanjBird.GIF" id="Cpic2"
      onmouseover="popImg(true,this.id);" onmouseout="popImg(false,this.id);">
    </div>
    
    </body>
    </html>
    Reply With Quote
      #2  
    Old 11-07-2009, 08:15 AM
    justinbarneskin justinbarneskin is offline
    Registered User
     
    Join Date: Oct 2006
    Posts: 529
    HTML Code:
    <div id="Container" style="position:relative">
     <img src="http://www.nova.edu/~rumsey/snoopy.gif" id="Cpic1" style="position:absolute;bottom:0px"
      onmouseover="popImg(true,this.id);" onmouseout="popImg(false,this.id);" >
     <img src="http://www.nova.edu/~rumsey/BanjBird.GIF" id="Cpic2"  style="position:absolute;bottom:0px;left:100px"
      onmouseover="popImg(true,this.id);" onmouseout="popImg(false,this.id);">
    </div>
    Reply With Quote
      #3  
    Old 11-07-2009, 08:17 AM
    justinbarneskin justinbarneskin is offline
    Registered User
     
    Join Date: Oct 2006
    Posts: 529
    The container must have style absolute or relative for the nodes to have their positioning to be effective within. Leave out container's style to see
    Reply With Quote
    Reply

    Bookmarks


    Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
     
    Thread Tools Search this Thread
    Search this Thread:

    Advanced Search
    Display Modes Rate This Thread
    Rate This Thread:

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is Off
    HTML code is Off
    Forum Jump


    All times are GMT -5. The time now is 11:55 PM.



    Acceptable Use Policy

    internet.comMediabistrojusttechjobs.comGraphics.com

    WebMediaBrands Corporate Info


    Advertise | Newsletters | Feedback | Submit News

    Legal Notices | Licensing | Permissions | Privacy Policy

    Powered by vBulletin® Version 3.7.3
    Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.