Website Positioning Help!

Grab your favourite IDE and tinker with the innards of game engines

Website Positioning Help!

Postby NightWolf on Fri May 25, 2007 12:40 am

I'm having problems with positioning things for the new design of my site.

I want it to look like this and go completely top to bottom.

Image

and here is what im getting

Image

CSS Code:
Code: Select all
@charset "utf-8";
/* CSS Document */

body {
text-align: center;
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:11px;
background-color:#526d7b;
}

#main_content_area
{
   width:900px;
    height:auto;
   background-color:ebebeb;
}

#left_bar
{
width:25px;
height:auto;
background-image:url(images/left_bar.gif);
background-repeat:repeat-y;
float:left;
}
   
#right_bar
{
width:25px;
height:auto;
background-image:url(images/right_bar.gif);
background-repeat:repeat-y;
float:right;
}


HTML Code
Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled</title>
<link href="inevmaps.css" rel="stylesheet" type="text/css" />
</head>

<body>

<div id="main_content_area">
<div id="left_bar"></div>
<div id="right_bar"></div>
This is starting to annoy me!
<p>
It needs to be centered and stretch all the way from the top to the bottom of any resolution moniter, including those gradient things on each side.
</div>

</body>
</html>
Image
User avatar
NightWolf
May Contain Skills
May Contain Skills
 
Joined: Tue Jul 12, 2005 11:55 pm
Location: The 4th Dimension...

Postby -[Getty]- on Fri May 25, 2007 1:54 am

Ok, it's been a while since my webdesign days, but I think this will help....


For the height on #main_content_area make it 100% instead of auto. Not sure if this will work, I can't remember for sure.

To get the top and bottom margins so the body goes up against the screen:

in the body area, type this:

Code: Select all
margin: 0px;


That will make all the margins 0 pixels. To get just the top and bottom margins 0, do this:

Code: Select all
margin-top: 0px;
margin-bottom: 0px;


As for centering, css isn't that great. One thing that worked for me is this:

Make a <div> outside the main content area. Make it's width 100%, make it's height 100% (if you don't set the height, it won't allow the inside div to go 100%) and make the text-align: center

That SHOULD work, but I'm not positive.
source-maps wrote:a Quad Core CPU , arent that like 4 cpus?


-=-=-=-=-=-=-=-=-
Club No Release
-=-=-=-=-=-=-=-=-
User avatar
-[Getty]-
Sir Post-a-lot
Sir Post-a-lot
 
Joined: Sun Nov 27, 2005 5:54 pm
Location: Pennsylvania

Postby NightWolf on Sat May 26, 2007 12:18 am

Thanks ^^ I will try that and see how it goes.
Image
User avatar
NightWolf
May Contain Skills
May Contain Skills
 
Joined: Tue Jul 12, 2005 11:55 pm
Location: The 4th Dimension...

Postby NightWolf on Sat May 26, 2007 2:06 am

I tried it and got some of it to work.
I was able to get everything centered and aligned to the top.

Now I need to know how to get it to go from the top to the bottom of the page at all times including those gradient things, I tried the percent thing and it didnt work.

Here is the new css code

Code: Select all
@charset "utf-8";
/* CSS Document */

body{
text-align:center;
background-color:#526d7b;
margin:0px;
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:11px;
}

#main_container{
background-color:ebebeb;
width:900px;
height:auto;
margin:auto;
}

#left_bar{
background-image:url(images/left_bar.gif);
background-repeat:repeat-y;
float:left;
height:auto;
width:25px;
}

#right_bar{
background-image:url(images/right_bar.gif);
background-repeat:repeat-y;
float:right;
height:auto;
width:25px;
}


Here is the new html code

Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link href="inevmaps.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div id="main_container">
<div id="left_bar"></div>
<div id="right_bar"></div>
</div>

</body>
</html>
Image
User avatar
NightWolf
May Contain Skills
May Contain Skills
 
Joined: Tue Jul 12, 2005 11:55 pm
Location: The 4th Dimension...

Postby NightWolf on Sun May 27, 2007 2:33 am

Anyone? :(
Image
User avatar
NightWolf
May Contain Skills
May Contain Skills
 
Joined: Tue Jul 12, 2005 11:55 pm
Location: The 4th Dimension...

Postby ChopperDave on Sun May 27, 2007 2:36 am

Honestly, I don't think it's possible. Have you seen this successfully implemented on another site? Can you give a URL if you know of one?
User avatar
ChopperDave
Rockstar San Diego
 
Joined: Wed Feb 21, 2007 6:06 pm

Postby NightWolf on Sun May 27, 2007 1:34 pm

interlopers.net :P
Image
User avatar
NightWolf
May Contain Skills
May Contain Skills
 
Joined: Tue Jul 12, 2005 11:55 pm
Location: The 4th Dimension...

Postby ChopperDave on Sun May 27, 2007 1:59 pm

Interlopers has content that expands it's background down the length of the page. I don't see a page on this site where there's little content and the background continues to stretch anyway.
User avatar
ChopperDave
Rockstar San Diego
 
Joined: Wed Feb 21, 2007 6:06 pm

Postby amckern on Sun May 27, 2007 2:05 pm

http://www.nigredostudios.com or http://www.noballs.org/privacy.htm

What i did was enter all my data in an empty table i made i MS Word (Hence the word css table at the top)
Image
NightFall Source Code - http://nightfallmod.com
User avatar
amckern
Pheropod
Pheropod
 
Joined: Mon Dec 20, 2004 3:26 am
Location: Sydney, Australia

Postby NightWolf on Sun May 27, 2007 2:26 pm

Thanks for the help, im thinking about doing things a little different. :-)
Image
User avatar
NightWolf
May Contain Skills
May Contain Skills
 
Joined: Tue Jul 12, 2005 11:55 pm
Location: The 4th Dimension...

Postby AcX on Sun May 27, 2007 3:59 pm

I normally use a basic page background for that kinda thing. Chuck this in your CSS:

Code: Select all
body {
margin:0;
background: #FFFFFF url(images/my_bg.jpg) repeat-y scroll top center;
}


You can change #FFFFFF to a colour that you want the bg surrounded by, if you fancy.

Bob's your uncle :)
User avatar
AcX
Sir Post-a-lot
Sir Post-a-lot
 
Joined: Sun Oct 10, 2004 8:58 am
Location: London, UK

Postby Shr3d on Sun May 27, 2007 4:08 pm

amckern wrote:http://www.nigredostudios.com or http://www.noballs.org/privacy.htm

What i did was enter all my data in an empty table i made i MS Word (Hence the word css table at the top)


Adam! You're alive!
Shr3d
 

Postby zombie@computer on Sun May 27, 2007 4:15 pm

amckern wrote:http://www.nigredostudios.com or http://www.noballs.org/privacy.htm

What i did was enter all my data in an empty table i made i MS Word (Hence the word css table at the top)
You are actually advising someone to use ms WORD to make a WEBSITE in HTML?????? That makes Hitler look like Ghandi to me
When you are up to your neck in shit, keep your head up high
zombie@computer
Forum Goer Elite™
Forum Goer Elite™
 
Joined: Fri Dec 31, 2004 5:58 pm
Location: Lent, Netherlands

Postby NightWolf on Sun May 27, 2007 9:34 pm

Thanks for the help everyone! Now it goes from top to bottom, the last thing I need help with is positioning the footer to the very bottom of the page.
Once the footer is in position its smooth sailing from there!

Here is my CSS code:

Code: Select all
@charset "utf-8";
/* CSS Document */

body{

margin:0px;
background: #526d7b url(images/bg.gif) repeat-y scroll top center;
text-align:center;
font-family:Verdana, Arial, Helvetica, sans-serif;
font-size:11px;
}

#main_container{
width:850px;
height:auto;
margin:auto;
}

#banner{
background-image:url(images/banner.jpg);
width:850px;
height:150px;
}

#nav_bar{
width:850px;
height:32px;
}

#navbar_content_division{
width:850px;
height:25px;
}

#footer
{
background-image:url(images/footer_bar.gif);
height:32px;
width:inherit;
}


And here is my HTML code:

Code: Select all
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<link href="inevmaps.css" rel="stylesheet" type="text/css" />

<script type="text/javascript">
<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>

</head>

<body onload="MM_preloadImages('images/home_over.gif','images/maps_over.gif','images/media_over.gif','images/forums_over.gif','images/about_over.gif','images/contact_over.gif')">

<div id="main_container">

   <div id="banner"></div>

      <div id="nav_bar">
<a href="http://inevmaps.hl2files.com/index.php" onmouseout="MM_swapImgRestore()" onmouseover=          "MM_swapImage('Home','','images/home_over.gif',1)"><img src="images/home.gif" name="Home" width="140" height="32" border="0" id="Home" /></a><a href="http://inevmaps.hl2files.com/maps.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Maps','','images/maps_over.gif',1)"><img src="images/maps.gif" name="Maps" width="142" height="32" border="0" id="Maps" /></a><a href="http://inevmaps.hl2files.com/media/index.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Media','','images/media_over.gif',1)"><img src="images/media.gif" name="Media" width="143" height="32" border="0" id="Media" /></a><a href="http://inevmaps.hl2files.com/forums/" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Forums','','images/forums_over.gif',1)"><img src="images/forums.gif" name="Forums" width="143" height="32" border="0" id="Forums" /></a><a href="http://inevmaps.hl2files.com/about.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('About','','images/about_over.gif',1)"><img src="images/about.gif" name="About" width="142" height="32" border="0" id="About" /></a><a href="http://inevmaps.hl2files.com/contact.php" onmouseout="MM_swapImgRestore()" onmouseover="MM_swapImage('Contact','','images/contact_over.gif',1)"><img src="images/contact.gif" name="Contact" width="140" height="32" border="0" id="Contact" /></a>       
          </div>
         
          <div id="navbar_content_division"></div>

   This should be all space and that bar below this text should stay at bottom of page regardless of amount of content on the page.

  <div id="footer">This will be text in the footer.</div>

</div>


</body>
</html>
Image
User avatar
NightWolf
May Contain Skills
May Contain Skills
 
Joined: Tue Jul 12, 2005 11:55 pm
Location: The 4th Dimension...

Postby amckern on Mon May 28, 2007 1:09 am

zombie@computer wrote:You are actually advising someone to use ms WORD to make a WEBSITE in HTML?????? That makes Hitler look like Ghandi to me


I had no idea how to center a table in the middle of the page, so i used some ms word hacks. :P

And yeah i roam around the world, been spending a fair amount of time at customfactor, and atomicmpc, when i'm not working or playing ns.
Image
NightFall Source Code - http://nightfallmod.com
User avatar
amckern
Pheropod
Pheropod
 
Joined: Mon Dec 20, 2004 3:26 am
Location: Sydney, Australia
Next

Return to Programming

Who is online

Users browsing this forum: No registered users