Results 1 to 2 of 2

Thread: image at center bottom of a div

  1. #1
    Join Date
    Oct 2007
    Posts
    1

    image at center bottom of a div

    Hi all,

    I'm new here and have a question right away.

    on the following url I have a website under construction for a vintage motorcycle maintenance shop.

    http://users.skynet.be/oldscoolmechanics/

    you can see a sideview of a motorcycle on the bottom of the brown pane, however when you resize the window, the bike doesn't stay at the bottom of the brown pane.

    Is there anybody who might know how to position a picture on the bottom of a DIV?

    It perfectly works when you place the image as background but then it cannot be used as link to go to the next page, which is the intention.

    Any info would be very welcome

    kind regards,

    Enfieldman.

  2. #2
    Join Date
    Feb 2006
    Location
    Salisbury UK
    Posts
    4,332
    You are using percentages in several styles which aren't working well. You have div.main height: 50%; div.intro height: 100% and class img.moto_intro top: 51%.

    If you change
    img.moto_intro{
    position:absolute;
    /*top:51%;*/bottom: 0;
    left:50%; /*was 35%;*/ margin-left: -165px;
    }

    It makes the image stick to the bottom of div.intro. This works in IE6, IE7, Firefox, Opera and Safari for Windows but I often think percentages can cause problems in some browsers.

    Changing left: 35% to left: 50%; margin-left: -165px; keeps the bike central in the width of a smaller window better than 35% because 35% is to the left side of the image which means that in a small window of say 500px the image starts at 175px and has a width of 310px so that the far side is at 485px so obviously it is not central.
    Code downloaded to my PC will be deleted in due course.
    WIN7; IE9, Firefox, Opera, Chrome and Safari for Windows; screen resolution usually 1366*768.
    Also IE6 on W98 with 800*600 and IE8 on Vista 1440*900.

Similar Threads

  1. Center a div inside another div
    By Lynxo in forum Web Design, HTML Reference and CSS
    Replies: 1
    Last Post: 12 Jan 2007, 07:20 AM
  2. CSS- relationship between image position and div elements?
    By web88js in forum Web Design, HTML Reference and CSS
    Replies: 1
    Last Post: 23 Nov 2006, 01:41 AM
  3. aligning image to bottom of div causing issues
    By archanix in forum Web Design, HTML Reference and CSS
    Replies: 1
    Last Post: 23 Aug 2005, 11:14 AM

Posting Permissions

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