centering is driving me nuts!

This is a discussion on "centering is driving me nuts!" within the Web Page Design section. This forum, and the thread "centering is driving me nuts! are both part of the Design Your Website category.



Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Oct 23rd, 2007, 17:26
Up'n'Coming Member
Join Date: Sep 2007
Location: Canterbury
Age: 31
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
centering is driving me nuts!

I know, I know. This has been covered millions of times before but I can't get anything to work. I want my nav menu to sit in the middle at the bottom but I can't get it to do so. Here's the code:

#footer {
position: absolute;
height:40px;
bottom:0px;
margin-left: 300px;
margin-right: 300px;
}

<div id="footer">
<ul class="menu1">
<li><a href="http://www.freewebs.com/mykl/home test.html"><b>Home</b></a></li>
<li><a href="#nogo"><b>Biography</b></a></li>
<li><a href="#nogo"><b>Gallery</b></a></li>
<li><a href="#nogo"><b>links</b></a></li>
<li><a href="#nogo"><b>Music</b></a></li>
<li><a href="#nogo"><b>Concert Diary</b></a></li>
<li><a href="#nogo"><b>Contact Us</b></a></li>
</ul>
</div>

This is the best I've got so far but it's a compromise. I tried putting the margin on auto but it doesn't work. My header is in the middle (as it should be) and I didn't even tell it to go there!
Reply With Quote

  #2 (permalink)  
Old Oct 23rd, 2007, 17:28
Marc's Avatar
Moderator

SuperMember
Join Date: Apr 2007
Location: Scotland, UK
Age: 15
Posts: 1,662
Thanks: 0
Thanked 9 Times in 9 Posts
Re: centering is driving me nuts!

Can you not put text-align:center; in the #footer ?
Reply With Quote
  #3 (permalink)  
Old Oct 23rd, 2007, 17:28
alexgeek's Avatar
Technical Administrator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,793
Blog Entries: 9
Thanks: 0
Thanked 2 Times in 2 Posts
Re: centering is driving me nuts!

position absolute messes up centering.
Why are you using it anyway?
Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Reply With Quote
  #4 (permalink)  
Old Oct 23rd, 2007, 17:32
Reputable Member
Join Date: Apr 2007
Location: Scotland
Age: 17
Posts: 233
Thanks: 0
Thanked 0 Times in 0 Posts
Re: centering is driving me nuts!

Code: Select all
body {
text-align: center;
}

#footer {
 margin: 0 auto;
 }
That should work.

Just remember to left align your text align somewhere else, like in your main div.
Reply With Quote
  #5 (permalink)  
Old Oct 23rd, 2007, 21:54
Up'n'Coming Member
Join Date: Sep 2007
Location: Canterbury
Age: 31
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
Re: centering is driving me nuts!

#footer {
position: absolute;
height:40px;
bottom:0px;
width: 50%;
margin-left: 301px;
margin-right: 301px;
text-align: center;
}

works the best so far. If I remove the position:absolute it messes everything else up, like puts the footer at the top and shoves everything over to the right so you can only see half of it! If anyone has ideas to fix these they will be most welcome!
Reply With Quote
  #6 (permalink)  
Old Oct 23rd, 2007, 21:56
alexgeek's Avatar
Technical Administrator

SuperMember
Join Date: Jul 2007
Location: Webforumz 24/7
Age: 15
Posts: 3,793
Blog Entries: 9
Thanks: 0
Thanked 2 Times in 2 Posts
Re: centering is driving me nuts!

I'm guessing you are using positon absolute for more than one element?

Hosting this somewhere would help see whats wrong. If you don't have a host try freewebs.com.

Last Blog Entry: 3D Chess in your browser! (Mar 14th, 2008)
Reply With Quote
  #7 (permalink)  
Old Oct 24th, 2007, 03:09
Most Reputable Member
Join Date: Feb 2004
Location: Borneo
Age: 27
Posts: 1,608
Blog Entries: 2
Thanks: 0
Thanked 4 Times in 3 Posts
Re: centering is driving me nuts!

how does your page/layout looks like?
I am sure every elements in your page is position: absolute, thats what causes the problem.
Last Blog Entry: ASP Programming Tips and Technique (Oct 26th, 2007)
Reply With Quote
  #8 (permalink)  
Old Oct 24th, 2007, 12:58
Up'n'Coming Member
Join Date: Sep 2007
Location: Canterbury
Age: 31
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
Re: centering is driving me nuts!

If anyone wants a look here's the address:

http://www.freewebs.com/mykl/home%20test.html

Yes, everything is positioned absolutely - if I take it out everything goes crazy! How can I put a <div> top centre, bottom centre, left and right and smack in the centre of the screen without position: absolute?
The layout I have (above) is almost how I want it but I get the idea that there's a better way of doing this...
Reply With Quote
  #9 (permalink)  
Old Oct 24th, 2007, 12:59
Up'n'Coming Member
Join Date: Sep 2007
Location: Canterbury
Age: 31
Posts: 53
Thanks: 0
Thanked 0 Times in 0 Posts
Re: centering is driving me nuts!

BTW the layout is my variation on this:

http://www.glish.com/css/7.asp
Reply With Quote
  #10 (permalink)  
Old Oct 25th, 2007, 12:13
SuperMember

SuperMember
Join Date: Sep 2006
Location: Pink House
Posts: 3,946
Thanks: 0
Thanked 0 Times in 0 Posts
Re: centering is driving me nuts!

Well that tutorial isn't the best due to the fact that it asks you to absolute position everything. In fact, burn that tutorial!

Here are some tutorials on liquid layouts. So much better for all types of screen resolutions.
http://bonrouge.com/3c-hf-fluid-lc.php
http://www.pmob.co.uk/temp/3colfixedtest_4.htm

Hope this helps!
Reply With Quote
Reply

Thread Tools

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 On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
This is driving me nuts! Please Help! dm2757 Flash & Multimedia Forum 1 Aug 22nd, 2007 21:30
Tables Driving my Insane! Zonglars Web Page Design 7 Jul 17th, 2007 01:19
CSS in IE and Firefox is driving me nuts Andy K Web Page Design 9 May 21st, 2005 12:32


All times are GMT. The time now is 10:42.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43