/    Sign up×
Community /Pin to ProfileBookmark

[RESOLVED] problem positioning image at bottom

Hey All,

I’m pretty new to CSS (three weeks), and I’m having trouble trying to position
an image at the bottom of my leftnav div.

Here’s a link to the test page…

[URL=”http://www.buffalosoftware.net/newtest4.htm”]http://www.buffalosoftware.net/newtest4.htm[/URL]

Here is the image I am trying to use…

[code=html]<a href=”http://www.lunarpages.com/id/buffsoft” onmouseover=”window.status=’http://www.lunarpages.com’;return true” onMouseOut=”window.status=”;return true”>
<img style=”border: none” src=”http://www.lunarpages.com/banners/images/static_125x40_01.gif” alt=”Lunarpages.com Web Hosting” /></a>[/code]

When I get it at the bottom using – position: absolute; – then I can’t get
it inside the leftnav div…When I get it inside the div, then I can’t get it to
go to the bottom.

I don’t know…I’m about to give up and forget it.

Thanks in advance for any help with this,
Ron

to post a comment
CSS

20 Comments(s)

Copy linkTweet thisAlerts:
@WebJoelJun 17.2007 — the only way you can "absolute-position" an image inside of anything is to make the [I]container[/I] have "position:relative;". This 'seizes control' over the starting point of "0,0" (left-top and top-left).

<div style="width:200px; height:400px; border:1px solid gray; [B]position:relative;[/B] padding-bottom:110px;">

this is the relative-positioned DIV

<img alt="This is the image" src="#" style="width:200px; height: 100px; background-color:blue; [B]position:absolute; left:0; bottom:0;[/B]" />

</div><!-- end "container" -->[/QUOTE]


Note that "position absolute" is 'out of the document flow' and if it is 'inside' of a relative-positioned container, the content of the container will over-write the image unless you give a padding equal-to or slightly greater than the height of the image. Here, the image is 100px tall, so the padding-bottom of the container DIV is 110px (giving you a nice 10-px 'pad' between bottom-most text and image.).

Ordinarily you'd not give an image a 'background-color' but I wanted to show in color ("blue"), where the image is.

p.s., -don't [I]give up[/I]... for the greater part, there is little that can be envisioned that cannot be created to some measure or another using CSS. -It is really quite versatile.
Copy linkTweet thisAlerts:
@rdcodyauthorJun 17.2007 — Hey WebJoel,

If I change the leftnav div from float: left; to position:relative, then the page

gets screwed up. Do I need to place another div inside the leftnav div to

accomplish this...if so how can I line it up?
Copy linkTweet thisAlerts:
@WebJoelJun 17.2007 — Hey WebJoel,

If I change the leftnav div from float: left; to position:relative, then the page

gets screwed up. Do I need to place another div inside the leftnav div to

accomplish this...if so how can I line it up?[/QUOTE]
Do both, float:left; if it needs to be, and "position:relative;". I think that this would work. Here, 'relative' is not really 'positioning' anything (there are not left or right position coordinates given), you are merely setting-up that container to accept an absolute-positioned element to [I]it's[/I] 0,0 corner.

back:

I just tested this, -works fine using both.
Copy linkTweet thisAlerts:
@rdcodyauthorJun 17.2007 — Like this...

[CODE]
#leftnav {
float:left;
position:relative;
overflow: hidden;
margin: 10px 0px 0px 12px;
width: 170px;
height: 96.4%;
text-align: center;
background-color: #808080;
border: 2px solid #9CB1C2;
background-image: url(images/leftnav.gif);
background-repeat: repeat-x;
background-position: top;
}

[/CODE]
Copy linkTweet thisAlerts:
@rdcodyauthorJun 17.2007 — WebJoel...

ok, I think the problem is now naming the two images (classes) correctly..

is it as simple as this?

.imageone {

}

.imagetwo {

}

may seem like a dumb question, but I still can't get it to work.

thanks
Copy linkTweet thisAlerts:
@rdcodyauthorJun 17.2007 — Trial and error...I think I got it...maybe

thanks WebJoel...have a good one
Copy linkTweet thisAlerts:
@rdcodyauthorJun 18.2007 — OK... I finally got it! (IE was acting a little squirrely)

I put this in the leftnav div
[CODE]
position: relative;
float:left;
[/CODE]


and instead of using margins
[CODE]
margin: 10px 0px 0px 12px;
[/CODE]


I used this
[CODE]
left: 12px;
top: 10px;
[/CODE]


Now it works good in FF and IE. ?

http://www.buffalosoftware.net/newtest6.htm

Thanks for your help WebJoel
Copy linkTweet thisAlerts:
@WebJoelJun 18.2007 — Looks good in IE and Fx? -Are we talking about the white 'lunarpages' image at the bottom of "left"?

See screenshots: -Works in IE, [I]missing[/I] in Firefox... -I'd trust Firefox to show this correctly, and IE to show you what you wanted to see... :o

[upl-file uuid=9d5a46ff-6c4a-4e55-aee4-b5d2b1b197cc size=8kB]IE.gif[/upl-file]

[upl-file uuid=6cfc1df6-a6d2-414c-a2bc-3717a0f37827 size=5kB]Firefox.gif[/upl-file]
Copy linkTweet thisAlerts:
@rdcodyauthorJun 18.2007 — yes...talking about the white 'lunarpages' image at the bottom of "left"

this works in firefox 2.0.0.4 for me...this doesn't show for you?

http://www.buffalosoftware.net/newtest6.htm
Copy linkTweet thisAlerts:
@WebJoelJun 18.2007 — yes...talking about the white 'lunarpages' image at the bottom of "left"

this works in firefox 2.0.0.4 for me...this doesn't show for you?

http://www.buffalosoftware.net/newtest6.htm[/QUOTE]


No, it doesn't show. ? -See the screenshots? This is IE6 and Firefox 2.0.0.4 It might be something wrong with the anchor, -there is no change in the cursor to iindicate a hyperlink. I do briefly see the alt="" text, but it dissappears..

Weirdness: , -if you give the leftnav a "backgrond-color:transparent; background-image:none;", the lunar images ...appears!

grr... i've got a headache... time to take a break. ?
Copy linkTweet thisAlerts:
@rdcodyauthorJun 18.2007 — Well...I don't know what to tell ya

I sent the link (newtest6.htm) to my wife where she works, and it works

in firefox just fine (lunarpages image and all).

weirdness for sure ?
Copy linkTweet thisAlerts:
@rdcodyauthorJun 18.2007 — also... I seen the screen shots, I was just wondering if you

noticed I changed the original link from newtest4.htm to

newtest6.htm
Copy linkTweet thisAlerts:
@WebJoelJun 18.2007 — Using the webdeveloper tool in Firefox to outline your DIVs in red, and display their size(s), -here (screenshot image) is what my Firefox is seeing. Trust that I am probably not the only one... :eek:

(I'll be re-visiting this again) ?

[upl-file uuid=ab004419-2c79-4bd3-9006-f1b4b88327bc size=14kB]ScreenHunter_1.gif[/upl-file]
Copy linkTweet thisAlerts:
@rdcodyauthorJun 18.2007 — Well...what in the world is going on. My wife just told me that in IE7 the

content is appearing again below where it orignates. How in the heck can I

fix this? There's got to be a way to place an image where I want it...

hopefully...right?
Copy linkTweet thisAlerts:
@WebJoelJun 18.2007 — I've only just begun to rip into this one... ? Clearly, something is 'floated' incorrectly or is not 'cleared' correctly... -It can be found. ?
Copy linkTweet thisAlerts:
@WebJoelJun 18.2007 — THIS works now in IE6 [B]and[/B] Firefox 2.0.0.4. I moved the lunar img to be a 'background-image' of the anchor, -and it works! I removed an image or two from un-necessary DIV-containment. -You don't need to encapsulate an image with a DIV in order to style it... you can apply the style directly to the image with either inline-style, or class="".

WTH is the reason this wasn't working, I dunno -but I'm goning to sit back, snap-open a cold one (or three) and

not

let

it

bother me

a n y m o r e

...tonight. ?

Try this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"

"http://www.w3.org/TR/html4/strict.dtd">

<html><head>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />

<meta http-equiv="Content-Style-Type" content="text/css" />

<meta http-equiv="Content-Script-Type" content="text/javascript" />

<title></title>


<script type="text/javascript"><!--

// -->

</script>

<link rel="shortcut icon" href="favicon.ico"><!-- path to your favicon -->

<style type="text/css">

/* body styles */

* {

margin: 0;

padding: 0;

}

html, body {

height: 101%; padding-bottom:10px;

}

body {

font-family: Verdana, Geneva, Arial, Helvetica, sans-serif;

font-size: 0.8em;

background-color: #9CB1C2;

}

#wrapper {

min-height: 100%; height:100%;

width: 760px;

background-color: #F5F5F5;

border: 2px solid #74899A;

margin: 10px auto 2px auto;

}


/* font styles */

h1 {

font-size : 100%;

font-weight: bold;

text-align : center;

line-height: 300%;

color: #000078;

margin: 0px 0px 0px 0px;

}

h2 {

font-size : 100%;

font-weight: bold;

text-align : center;

color: #780000;

margin: 10px 0px 0px 0px;

}

p.mainleft {

/*font-family : sans-serif,arial,geneva,helvetica;*/

font-size : 100%;

font-weight: normal;

text-align : left;

text-indent : 20px;

color: #000000;

}

p.maincenter {

/*font-family : sans-serif,arial,geneva,helvetica;*/

font-size : 100%;

font-weight: normal;

text-align : center;

color: #000000;

}

/* space styles (1=16px) */

#sp8 {

height: 128px;

}

/* content styles */

#content {

position: relative;

text-align : center;

background-color: #F5F5F5;

/*background-color: #800000;*/

height: 96.4%;

width: 530px;

margin: 10px 25px 0px 207px;

}

  • * html #content {

    margin: 10px 12px 0px 204px;

    }


  • #content img {

    position: absolute;

    top: auto;

    bottom: 25px;

    left: 180px;

    height: 69px;

    border: 0;

    }

    /* navigation styles */

    #leftnav {

    position: relative;

    float:left;

    /*margin: 10px 0px 0px 12px;*/

    left: 12px;

    top: 10px;

    width:170px;

    height:96%;

    text-align: center;

    border: 2px solid #9CB1C2;

    background: #808080 url(http://www.buffalosoftware.net/images/leftnav.gif) repeat-x;

    }

    /*

    *
    html #leftnav{

    margin: 10px 0px 0px 6px;

    }*/

    #leftnav a:link {

    color: #D2D2D2;

    }

    #leftnav a:visited {

    color: #D2D2D2;

    }

    #leftnav a:hover {

    color: #E6E6E6;

    font-weight: bold;

    }

    p.nav {

    font-size : 100%;

    font-weight: normal;

    text-align : center;

    line-height: 220%;

    }

    .imglogo {

    position:relative;

    margin-top:4px;

    margin-left: 1px;

    margin-bottom: 30px;

    height: 112px;

    }

    .imglunar {

    bottom: 6px;

    left: 5px;

    height: 45px;

    width: 130px;

    border: 0;

    }

  • * html .imglunar{

    bottom: 3px;

    }


  • /* bottom nav styles */

    #navlinks {

    position: absolute;

    top: auto;

    bottom: 0px;

    left: 0px;

    background-color: #F5F5F5;

    height: 10px;

    width: 530px;

    }

    /* footer styles */

    #footer {

    clear: both;

    width: 760px;

    text-align: center;

    background-color: #9CB1C2;

    height: 20px;

    margin: 8px auto 0 auto;

    }

    p.smfont{

    font-size : 80%;

    font-weight: normal;

    text-align : center;

    color: #000000;

    }

    </style>

    <base href="http://www.buffalosoftware.net/" />

    </head>

    <body>



    <div id="wrapper" style="position:relative;">


    <div id="leftnav">

    <img src="images/buffsoftlogo.gif" alt="Buffalo Software" style="margin-top:10px; width:113px; height:112px;" />


    <p class="nav"><a href="index.htm">Home</a></p>

    <p class="nav"><a href="products.htm">Products</a></p>

    <p class="nav"><a href="contact.htm">Contact</a></p>


    <a href="http://www.lunarpages.com/id/buffsoft" style="position:absolute; left:10px; bottom:20px; width:140px; height:40px; padding:0; margin:0; border:2px solid blue; background-color:gray; background-image:url(http://www.lunarpages.com/banners/images/static_125x40_01.gif)"></a>

    </div>



    <div id="content" style="">

    <h1>Buffalo Software</h1>

    <p class="mainleft">Welcome to the home of Buffalo Software. Thank you for your interest in our products. We take pride in creating innovative, high quality, and easy to use software. By the way, all of our software is FREE! So, take them for a test drive, and see what you think. Enjoy!</p>


    <div id="sp8"></div>

    <h1>coming soon...</h1>

    <p>The PC Timer 5.0</p>

    <p>The Patriot 3.0</p>

    <p><a href="http://www.buffalofieldcampaign.org"><img src="images/savebuffalo.gif" alt="Save the Buffalo!" width="170" height="69"/></a></p>

    <div id="navlinks"><p class="smfont"><a href="index.htm">Home</a> •

    <a href="products.htm">Products</a> •

    <a href="contact.htm">Contact</a></p>

    </div>

    </div>

    <div id="footer" style="position:relative; top:4px; width:756px; padding:7px 0 2px 0; border:2px solid #f5f5f5; border-top:5px solid f5f5f5; margin-bottom:10px;"><p class="smfont">Copyright &copy; 2007 Buffalo Software - All rights reserved. Please read our <a href="privacy.htm">Privacy Statement.</a></p></div>

    </div>

    </body>

    </html>[/QUOTE]
    Copy linkTweet thisAlerts:
    @rdcodyauthorJun 19.2007 — Hey Joel... thanks alot - I'll look it over more closely tomorrow and try to

    learn from what you did. Have a good one, Ron
    Copy linkTweet thisAlerts:
    @WebJoelJun 19.2007 — Fingers are crossed! ?
    Copy linkTweet thisAlerts:
    @rdcodyauthorJun 21.2007 — Hey Joel,

    I decided to forget the lunarpages image, and just go with what I had.

    I appreciate all your help. The page checks out in IE6 and 7, Fx, and Opera.

    By the way, that Web Developer toolbar for Fx is pretty slick. ?

    http://www.buffalosoftware.net/index.htm

    Thanks, and have a good one! ?

    Ron
    Copy linkTweet thisAlerts:
    @WebJoelJun 21.2007 — Very nice. ?
    ×

    Success!

    Help @rdcody spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 6.17,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @nearjob,
    tipped: article
    amount: 1000 SATS,

    tipper: @meenaratha,
    tipped: article
    amount: 1000 SATS,

    tipper: @meenaratha,
    tipped: article
    amount: 1000 SATS,
    )...