CSS Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignCSS Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old January 25th, 2004, 04:44 AM
thall89553 thall89553 is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jan 2004
Location: Budapest
Posts: 1,420 thall89553 User rank is Private First Class (20 - 50 Reputation Level)thall89553 User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 15 h 29 m
Reputation Power: 6
Send a message via Yahoo to thall89553
CSS - Please help me

Ok, I want web page whose body bgcolor is black, I want a div which will be an overall container for the rest of the sites divs, and it will be 770 in width, and 100% in height of the page. So, no matter how much content in nested in it, it will always reach the browsers bottom. If the browser is larger than than 800 wide, the containing div should be centered, with equal space on both sides. I want all of this as I like a web site which when viewed bigger than 800, it doesn't sit in the left side of the window as most do, with a huge space of nothing beyond its right border...
__________________
Today the world, tomorrow the universe...

Reply With Quote
  #2  
Old January 25th, 2004, 02:11 PM
edwinbrains's Avatar
edwinbrains edwinbrains is offline
Retired Moderator
Dev Shed God 4th Plane (6500 - 6999 posts)
 
Join Date: Jan 2004
Location: London, UK
Posts: 6,670 edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)  Folding Points: 85411 Folding Title: Advanced FolderFolding Points: 85411 Folding Title: Advanced FolderFolding Points: 85411 Folding Title: Advanced FolderFolding Points: 85411 Folding Title: Advanced FolderFolding Points: 85411 Folding Title: Advanced Folder
Time spent in forums: 1 Week 6 Days 23 h 39 m 19 sec
Reputation Power: 92
Hi,

How about this:

Code:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script language="javascript" type="text/javascript">
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else {
    if( document.documentElement &&
        ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
      //IE 6+ in 'standards compliant mode'
      myWidth = document.documentElement.clientWidth;
      myHeight = document.documentElement.clientHeight;
    } else {
      if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
        //IE 4 compatible
        myWidth = document.body.clientWidth;
        myHeight = document.body.clientHeight;
      }
    }
  }
</script>
<style type="text/css">
<!--
body {
	background-color: #000000;
}
.divmain {
	height: 100%;
	width: 770px;
	background-color: #FFFFFF;
}
-->
</style>
</head>

<body>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
	<script  language="javascript" type="text/javascript">
		document.write('<tr height="' + myHeight + '">');	
	</script>
		<td align="center"><div class="divmain">Text</font></td>
	</tr>
</table>
</body>
</html>

Reply With Quote
  #3  
Old January 31st, 2004, 05:45 PM
chrisab508 chrisab508 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 67 chrisab508 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
this actually looks like something i might use, but i would like to know what everything is before i start using it, so first of all:

why is the java necessary? I don't know any java, and what just wondering why it was necessary?

thanks

Reply With Quote
  #4  
Old January 31st, 2004, 05:45 PM
chrisab508 chrisab508 is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Posts: 67 chrisab508 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 5
this actually looks like something i might use, but i would like to know what everything is before i start using it, so first of all:

why is the java necessary? I don't know any java, and what just wondering why it was necessary?

thanks

sorry for double post

Reply With Quote
  #5  
Old January 31st, 2004, 07:26 PM
Detrifuse's Avatar
Detrifuse Detrifuse is offline
Bites when cornered
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Location: Back from Iraq!
Posts: 109 Detrifuse User rank is Corporal (100 - 500 Reputation Level)Detrifuse User rank is Corporal (100 - 500 Reputation Level)Detrifuse User rank is Corporal (100 - 500 Reputation Level)Detrifuse User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 7
The script edwinbrains posted gathers the client area's width and height, and places the height in the <tr> portion of a table statement. That is one method using HTML and javascript, but it seems to set the size only initially, not sure if it is resize friendly. If one had content that fit in the table upon load, and the user made the window larger, then it looks like the table would stay the same size (since the height is set in pixels insted of 100%). From the sound of what you wanted, I'd do it in css only, maybe something like:
Code:
/* CSS: */
body
{
  padding: 0;
  margin: 0;
  background-color: rgb(0,0,0);
}

.maincontent
{
  position: absolute;
  left: 50%;
  width: 770px;
  height: 100%;
/* margin is negative one half of width */
  margin: -385px;
/* this with the left: 50% should center an absolutely positioned div */
}

Cheers to kk5st who brought the negative margin centering trick to my attention.


HTH
__________________
Obstruct the doors, cause delays, be dangerous.

Reply With Quote
  #6  
Old February 1st, 2004, 12:44 AM
edwinbrains's Avatar
edwinbrains edwinbrains is offline
Retired Moderator
Dev Shed God 4th Plane (6500 - 6999 posts)
 
Join Date: Jan 2004
Location: London, UK
Posts: 6,670 edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)edwinbrains User rank is Second Lieutenant (5000 - 10000 Reputation Level)  Folding Points: 85411 Folding Title: Advanced FolderFolding Points: 85411 Folding Title: Advanced FolderFolding Points: 85411 Folding Title: Advanced FolderFolding Points: 85411 Folding Title: Advanced FolderFolding Points: 85411 Folding Title: Advanced Folder
Time spent in forums: 1 Week 6 Days 23 h 39 m 19 sec
Reputation Power: 92
I would agree with Detrifuse. I don't think my code is very resize friendly. Detrifuse's code does look better!

Reply With Quote
  #7  
Old February 1st, 2004, 01:34 AM
thall89553 thall89553 is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jan 2004
Location: Budapest
Posts: 1,420 thall89553 User rank is Private First Class (20 - 50 Reputation Level)thall89553 User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 15 h 29 m
Reputation Power: 6
Send a message via Yahoo to thall89553
Interesting thing, I have been using this code and for some reason, the container div is perfectly centered in both Netscape and IE, but there is nothing in the code which is centering it, nor can I move the div so it is left aligned on the page??? Here is the code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">
<head>
<meta name="GENERATOR" content="Microsoft FrontPage 5.0" />
<meta name="ProgId" content="FrontPage.Editor.Document" />
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252" />
<title>Navigation</title>
<style type="text/css" media="screen">
html{
height:100%;
}
body{
margin: 0;
padding: 0;
font: 85% arial, hevetica, sans-serif;
color: #000;
background-color: #00f;
height: 100%;
border: 0px solid red;
}
#container{
margin: 0px auto;
width: 770px;
height: 100%;
text-align: left;
background-color: #f00;
background-image: url('images/keybg.jpg');
background-repeat: no-repeat;
border: 0px solid red;
}
</style>
</head>
<body>
<div id="container" >

</div>
</body>
</html>

Reply With Quote
  #8  
Old February 1st, 2004, 01:59 AM
kk5st's Avatar
kk5st kk5st is offline
Thanks Johnny Hart (BC) R.I.P.
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: May 2003
Location: Dallas
Posts: 4,585 kk5st User rank is Brigadier General (60000 - 70000 Reputation Level)kk5st User rank is Brigadier General (60000 - 70000 Reputation Level)kk5st User rank is Brigadier General (60000 - 70000 Reputation Level)kk5st User rank is Brigadier General (60000 - 70000 Reputation Level)kk5st User rank is Brigadier General (60000 - 70000 Reputation Level)kk5st User rank is Brigadier General (60000 - 70000 Reputation Level)kk5st User rank is Brigadier General (60000 - 70000 Reputation Level)kk5st User rank is Brigadier General (60000 - 70000 Reputation Level)kk5st User rank is Brigadier General (60000 - 70000 Reputation Level)kk5st User rank is Brigadier General (60000 - 70000 Reputation Level)kk5st User rank is Brigadier General (60000 - 70000 Reputation Level)kk5st User rank is Brigadier General (60000 - 70000 Reputation Level)kk5st User rank is Brigadier General (60000 - 70000 Reputation Level) 
Time spent in forums: 1 Month 2 Days 16 h 15 m 18 sec
Reputation Power: 662
Code:
#container{
margin: 0px auto;
width: 770px;
height: 100%;
text-align: left;
background-color: #f00;
background-image: url('images/keybg.jpg');
background-repeat: no-repeat;
border: 0px solid red;
}
Since you are in compliance mode, the "margin: 0 auto;" centers the div even in IE.

cheers,

gary
__________________
There are those who manage to build a web site without knowing what they're doing; thereby proving to themselves they do, indeed, know what they're doing.

My html and css workshop, demos and tutorials.
Ask a better question, get a better answer.

Reply With Quote
  #9  
Old February 1st, 2004, 02:01 AM
thall89553 thall89553 is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jan 2004
Location: Budapest
Posts: 1,420 thall89553 User rank is Private First Class (20 - 50 Reputation Level)thall89553 User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 15 h 29 m
Reputation Power: 6
Send a message via Yahoo to thall89553
I will look it up, but "compliance mode" as opposed to? and what defines this? Thanks Gary.

Reply With Quote
  #10  
Old February 1st, 2004, 02:16 AM
kk5st's Avatar
kk5st kk5st is offline
Thanks Johnny Hart (BC) R.I.P.
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: May 2003
Location: Dallas
Posts: 4,585 kk5st User rank is Brigadier General (60000 - 70000 Reputation Level)kk5st User rank is Brigadier General (60000 - 70000 Reputation Level)kk5st User rank is Brigadier General (60000 - 70000 Reputation Level)kk5st User rank is Brigadier General (60000 - 70000 Reputation Level)kk5st User rank is Brigadier General (60000 - 70000 Reputation Level)kk5st User rank is Brigadier General (60000 - 70000 Reputation Level)kk5st User rank is Brigadier General (60000 - 70000 Reputation Level)kk5st User rank is Brigadier General (60000 - 70000 Reputation Level)kk5st User rank is Brigadier General (60000 - 70000 Reputation Level)kk5st User rank is Brigadier General (60000 - 70000 Reputation Level)kk5st User rank is Brigadier General (60000 - 70000 Reputation Level)kk5st User rank is Brigadier General (60000 - 70000 Reputation Level)kk5st User rank is Brigadier General (60000 - 70000 Reputation Level) 
Time spent in forums: 1 Month 2 Days 16 h 15 m 18 sec
Reputation Power: 662
You will find a decent explanation at AppleDev, plus links to more specific answers.

gary

Reply With Quote
  #11  
Old February 1st, 2004, 02:29 AM
thall89553 thall89553 is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jan 2004
Location: Budapest
Posts: 1,420 thall89553 User rank is Private First Class (20 - 50 Reputation Level)thall89553 User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 15 h 29 m
Reputation Power: 6
Send a message via Yahoo to thall89553
Thanks so much, that site you pointed me to yesterday is unavaiable, that being /*pei*/, unfortuantely. I am just racking my brain out on this stuff, I am trying to understand the "doc flow" so to speak, in relation to positioning, just when I think I am getting it, something like this happens - http://tmh.netdbs.com/turnkey/default7.htm
I had it all figured out, until I added content to the mainbod area, and by doing so, it just served to extend it beyond the nav area in IE, in NS, it pushes the text right out of its containing block, that being mainbod. As I wrote earlier, I will rtfm and look up various tutorials on positioning. I have an O'Reily book which seems to be fairly good at this. By the way, this devshed site is great, but one the home page, it seems I need to actually generate a "search" to get to the forum section, and once I am in the site and logged in (via cookie I assume) I can't seem to figure out how to go to my personal information and see post I have submitted, etc. Take good care and thanks for advice. Tom PS, I peeked at that above link and it looks really great, thanks!

Reply With Quote
  #12  
Old February 1st, 2004, 09:19 AM
thall89553 thall89553 is offline
Contributing User
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Jan 2004
Location: Budapest
Posts: 1,420 thall89553 User rank is Private First Class (20 - 50 Reputation Level)thall89553 User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 4 Days 15 h 29 m
Reputation Power: 6
Send a message via Yahoo to thall89553
Ok, so the tutorial in the link above pointed me to Appledev and it is an awesome resource which further pointed me in different directions. For this solution only, I have integrated minimal usages of tables to accomplish my design pursuit. (only because I need to get this project done asap) I have it looking identical in both IE and NS but one small problem, I want it to fill 100% of the screen. I tried every variation I could on both the divs, table, and td's, but all to know avail. Here is the site, if anyone could peek at it and tell me how to get 100% height, I sure would apprecaite it. If only in IE, that would be ok for now. Thanks, Tom

http://tmh.netdbs.com/turnkey/layout.htm

Reply With Quote
  #13  
Old February 1st, 2004, 03:36 PM
kk5st's Avatar
kk5st kk5st is offline
Thanks Johnny Hart (BC) R.I.P.
Dev Shed Demi-God (4500 - 4999 posts)
 
Join Date: May 2003
Location: Dallas
Posts: 4,585 kk5st User rank is Brigadier General (60000 - 70000 Reputation Level)kk5st User rank is Brigadier General (60000 - 70000 Reputation Level)kk5st User rank is Brigadier General (60000 - 70000 Reputation Level)kk5st User rank is Brigadier General (60000 - 70000 Reputation Level)kk5st User rank is Brigadier General (60000 - 70000 Reputation Level)kk5st User rank is Brigadier General (60000 - 70000 Reputation Level)kk5st User rank is Brigadier General (60000 - 70000 Reputation Level)kk5st User rank is Brigadier General (60000 - 70000 Reputation Level)kk5st User rank is Brigadier General (60000 - 70000 Reputation Level)kk5st User rank is Brigadier General (60000 - 70000 Reputation Level)kk5st User rank is Brigadier General (60000 - 70000 Reputation Level)kk5st User rank is Brigadier General (60000 - 70000 Reputation Level)kk5st User rank is Brigadier General (60000 - 70000 Reputation Level) 
Time spent in forums: 1 Month 2 Days 16 h 15 m 18 sec
Reputation Power: 662
As an alternative to a lot of blank space, put your entire page into a single cell table. The default will center the page vertically. An example is here.

gary

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignCSS Help > CSS - Please help me


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off