Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
Setting the height of a DIV
Old 04-11-2007, 08:27 AM Setting the height of a DIV
Ultra Talker

Posts: 316
Trades: 0
http://londonlabs.co.uk/test/

I have a DIV that I would like to be 20px from the top, right and bottom edges of the page. It is the DIV on the right of this page:
http://londonlabs.co.uk/test/

At the moment it is cutting off any content that is off the page so to speak (do ctrl + a to highlight missing text).

This is my body CSS code:
Code:
body {
    background-image: url(images/bg-new.JPG);
    background-repeat: repeat;
    background-color: #00CCFF;
    background-attachment: fixed;
    margin: 0px;
    padding: 0px;
    height:100%;
}
This is the code for the DIV:
Code:
#websites {
    border: 1px solid #7F7F7F;
    width: 300px;
    padding: 1px 5px;
    font-family: Tahoma, Arial, sans-serif;
    font-size: 12px;
    font-weight: normal;
    color: #7F7F7F;
    line-height: 140%;
    letter-spacing: normal;
    text-align: left;
    vertical-align: top;
    position:absolute;
    right:20px;
    top:20px;
    bottom:20px;
    background-color: #FFFFFF;
}
Different things are happening in IE6 & FF1.5 but neither are displaying it as I would like.

If you resize your browser window and refresh the page the DIV changes size. Is there anyway to keep it 20px from the top, bottom and right even if the screen is resized and still keep the content in it visible?

Any ideas?

Thanks.

Last edited by Joe3000; 04-11-2007 at 08:31 AM.. Reason: added addtional content
Joe3000 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 04-11-2007, 02:21 PM Re: Setting the height of a DIV
LadynRed's Avatar
Defies a Status

Posts: 10,016
Location: Tennessee
Trades: 0
I would use position:relative rather than the absolute and would float that #websites div to the right with the 20px margin that you want it to have.

The column should stretch to fit the content in it, and that should push any divs below it down as it stretches vertically.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 04-11-2007, 03:38 PM Re: Setting the height of a DIV
ADAM Web Design's Avatar
Canadastaninianite

Posts: 5,938
Name: Adam for web page design, not program
Location: Toronto, Ontario, Canada
Trades: 0
It might be simpler than that:

body {
padding: 20px;
}

See if you can work with that.
__________________

Please login or register to view this content. Registration is FREE
|
Please login or register to view this content. Registration is FREE
(my blog)


Please login or register to view this content. Registration is FREE
(with proof)
ADAM Web Design is offline
Reply With Quote
View Public Profile Visit ADAM Web Design's homepage!
 
Old 04-11-2007, 06:21 PM Re: Setting the height of a DIV
Ultra Talker

Posts: 316
Trades: 0
Quote:
Originally Posted by ADAM Web Design View Post
It might be simpler than that:

body {
padding: 20px;
}

See if you can work with that.
no joy mate
Joe3000 is offline
Reply With Quote
View Public Profile
 
Old 04-11-2007, 06:26 PM Re: Setting the height of a DIV
Ultra Talker

Posts: 316
Trades: 0
Quote:
Originally Posted by LadynRed View Post
I would use position:relative rather than the absolute and would float that #websites div to the right with the 20px margin that you want it to have.

The column should stretch to fit the content in it, and that should push any divs below it down as it stretches vertically.
Thats spot on.

Thanks.
Joe3000 is offline
Reply With Quote
View Public Profile
 
Old 06-26-2007, 06:18 PM Re: Setting the height of a DIV
Ultra Talker

Posts: 316
Trades: 0
I have another question relating to this.

I have a DIV that I would like to be scrollable.

It runs vertically from the top of the screen to the bottom.

I would like its height to be 100% of the browser window, if the content in the DIV is longer than the size of the browser window then I would like it to be scrollable.

I can get this to work if the DIV has a fixed height but not a percentage - is this possible?

http://londonlabs.co.uk/test/
Joe3000 is offline
Reply With Quote
View Public Profile
 
Old 06-26-2007, 09:08 PM Re: Setting the height of a DIV
LadynRed's Avatar
Defies a Status

Posts: 10,016
Location: Tennessee
Trades: 0
You've got some errors in there. You have several of these:
<div class="strips" id="strips'>. You also have "id="websites" multiple times.
You can't do that, ID's MUST be unique. Classes are reusable ojn a page, ID's are not.

Its no wonder it's not working for you. Clean that up and then you might get somewhere.
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to Setting the height of a DIV
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.24411 seconds with 12 queries