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
Layout: Changing Width from fixed to per cent
Old 12-05-2008, 11:28 AM Layout: Changing Width from fixed to per cent
Ultra Talker

Posts: 316
Trades: 0
I am using this CSS to have a centered DIV that is a fixed width:
Code:
body {
    margin: 0px;
    padding: 0px;
    font-family: Tahoma, Arial, sans-serif;
    font-size: 11px;
    background-attachment: fixed;
    /* background-image: url(leaf-small.jpg); */
    background-repeat: no-repeat;
    background-position: left bottom;
    line-height: 18px;
}
#global {
    position:absolute;
    left: 50%; 
    top: 50%;
    width: 760px;
    height: 500px;
    margin-top: -250px; /* half of the height */
    margin-left: -380px; /* half of the width */
    border: 1px solid #000;
    background-color: grey;
}
I would like to change it so that the width of the DIV is 90% but still in the center of the page.

Any ideas?

view page
Joe3000 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 12-05-2008, 11:36 AM Re: Layout: Changing Width from fixed to per cent
LadynRed's Avatar
Defies a Status

Posts: 10,016
Location: Tennessee
Trades: 0
Why are you using position:absolute ?? That's just a bad idea to start with.

You also shouldn't be using px for your font sizes and line-heights, it prevents IE users from resizing if they choose to.

Check this if you just have to have absolute positioning:
http://css-discuss.incutio.com/?page...ngBlockElement
__________________
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


Last edited by LadynRed; 12-05-2008 at 11:38 AM..
LadynRed is offline
Reply With Quote
View Public Profile
 
Old 12-05-2008, 12:26 PM Re: Layout: Changing Width from fixed to per cent
Ultra Talker

Posts: 316
Trades: 0
I don't know to be honest.

Just an example I found.

I'll have a look at that link.

Thanks.

edit: right have adjusted it using the information on that link and have a new issue.

I want the middle coulmn, col2, to be whatever size width is left.

Something like col1: 100px, col2: fill the gap, col3: 100px;

Any ideas?
Code:
#col1 {
    width: 100px;
}
#col2 {
    width: *%;
}
#col3 {
    width: 100px;
}

Last edited by Joe3000; 12-05-2008 at 12:44 PM..
Joe3000 is offline
Reply With Quote
View Public Profile
 
Old 12-05-2008, 03:15 PM Re: Layout: Changing Width from fixed to per cent
Super Talker

Posts: 107
Name: Sandy
Trades: 0
What is the total width of the body? Take 200px off of that and allow for some gutter room and that could be the column width you are looking for.
__________________
Sandy K
sandyk3 is offline
Reply With Quote
View Public Profile
 
Old 12-05-2008, 03:20 PM Re: Layout: Changing Width from fixed to per cent
LadynRed's Avatar
Defies a Status

Posts: 10,016
Location: Tennessee
Trades: 0
Actually, if you want #col2 to fill the remaining width, don't give it a fixed width at all, it will, by default, take up the remaining space.
__________________
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 12-08-2008, 12:58 PM Re: Layout: Changing Width from fixed to per cent
Ultra Talker

Posts: 316
Trades: 0
I tried that:
Code:
#col1, #col2, #col3    {
    border: 1px solid #000CCC;
    margin: 1px;
    padding: 1px;
    background-color: green;
    float: left;
    height: 100%;
}
#col1 {
    width: 100px;
}
#col2 {
}
#col3 {
    width: 100px;
}

Its just gone really small:
http://www.jfwebdesign.co.uk/help/
Joe3000 is offline
Reply With Quote
View Public Profile
 
Old 12-08-2008, 03:33 PM Re: Layout: Changing Width from fixed to per cent
LadynRed's Avatar
Defies a Status

Posts: 10,016
Location: Tennessee
Trades: 0
Ok, my bad - since it's floated, you HAVE to give it a width.
__________________
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 Layout: Changing Width from fixed to per cent
 

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 2.12198 seconds with 12 queries