3 replies [Last post]
iamjared
Offline
newbie
Last seen: 16 years 29 weeks ago
Joined: 2005-12-15
Posts: 4
Points: 0

i know this is a longshot... and i have a tendency to wish code can make up for things i can't figure out.

i was wondering, does CSS have any way to tell a div to run to the end of the page? for example, if i want to start a div at a fixed position of "left: 70px", and i want it to run all the way to the right border of the page?

i know i can figure out the pixels or percentage, but it's going to look different on each user's computer.

any ideas guys?

thanks,

jared

Tyssen
Tyssen's picture
Offline
Moderator
Brisbane
Last seen: 7 years 38 weeks ago
Brisbane
Timezone: GMT+10
Joined: 2004-05-01
Posts: 8201
Points: 1386

a longshot.. but having a div run to the end of the page?

Can you show us your code because there could be various different ways of achieving the same effect?

How to get help
Post a link. If you can't post a link, jsFiddle it.
My blog | My older articles | CSS Reference

iamjared
Offline
newbie
Last seen: 16 years 29 weeks ago
Joined: 2005-12-15
Posts: 4
Points: 0

a longshot.. but having a div run to the end of the page?

well its more of a theoretical question.. but here's an example... this page had a 190px high image at the top of the page, under that i wanted to have a <div> which housed the content of the page that would only run to the BOTTOM of the page, so any scrolling would take place within that <div> and not with the main browser scrollbars. like...

#menu {
background: #cccc33 url(yellow.png) repeat;
font: 12px Arial, Helvetica, Verdana, "Lucida Grande", Genava, sans-serif;
width: 600px;
height: 190px;
}

#contentframe {
background: #e6e6e6;
font: 12px Arial, Helvetica, Verdana, Genava, sans-serif;
overflow: auto;
width: 600px;
position: fixed;
top: 190px;
}

so how can i make the contentframe div end at essentially "bottom: 0px"...

or... i suppose.. have the div start at bottom:0px and end 190px from the top?

ragamuffin
ragamuffin's picture
Offline
Leader
Iowa
Last seen: 13 years 16 weeks ago
Iowa
Joined: 2005-06-02
Posts: 691
Points: 0

a longshot.. but having a div run to the end of the page?

I am not sure that is possible with css, because for overflow:auto or overflow:scroll to work, you need a height defined. I wonder if you could use a javascript that would recognize the height of the user's browser window and automate the height that way. :?

- r