Freelancers Network
 
skill list top cap
Homepage
Join the Freelancer's Network
Update your details
Find a freelancer
Post a project
Find a project
Projects Archive
Post a job
Find a job
Jobs Archive
See Dan's Pages
See Andy's Pages
Link to this site
Resources
Join/Leave Forum
Forum Messages
+Additions+ Adverts
Advertising
Contact Us
Subscribe to our newsletter - enter your email address and hit return
Freelancers.net is owned and operated by Andy Stowell and Dan Winchester
skill list end cap
guru web hostcom

Find me again on Freelancers.net

Re: FN-FORUM: Css horizontal alignment (mark II)

date posted 3rd September 2007 23:56

Hi John

Hope I'm not too late being a Monday it was a nightmare getting home today
but anyways.... If you've not already sorted your problem I've tested a
solution and it works, see below:

In your css replace everything above (and including) .centeralign with:

****Please make a copy of your original code first, one just in case and two
so that you can compare them and see what changes were made to make it work
(and for everyone else the reason margin-left: auto; margin-right: auto is
use instead of margin: 0 auto; is so that you can specify a top and bottom
margin)****

body {
margin-left: auto;
margin-right: auto;
margin-top: 10px;
margin-bottom: 10px;
background-image: url('images/background.gif');
background-position: 50% 0%;
background-repeat: no-repeat;
background-color: #d6d6d6;
font-family: Arial, Helvetica, sans-serif;
font-size: 0.8em;
font-style: normal;
line-height: normal;
font-weight: normal;
font-variant: normal;
text-decoration: none
}

#page
{
margin-left: auto;
margin-right: auto;
text-align: center;
position: relative;
top: 0px;
left: 0px;
}

.centrealign {
width: 700px;
background-color: transparent;
text-align: center;
padding: 0px;
position: relative;
margin-left: auto;
margin-right: auto;
}

.bottompara
{
width: 680px;
padding-right: 10px;
margin: 0px;
}

Then in your html wrap everything on the page inside a div called page:




Also in IE7 a large white box appears at the top, wasnt sure if that was
meant to be there so I gave .centrealign a transparent background instead of
white to remove it, change it back if you want a white box and also give the
class .top a white background too so that its white in firefox.


*** This is for if the top white box is to be removed [begin]***

Then give your paragraph at the bottom a class of class="bottompara", if
you do not you will see why. (This si for IE7, doesnt affect Firefox)

*** This is for if the top white box is to be removed [end]***


This works for IE7 & firefox 2, not tested in IE6 but it should work, ive
not taken the complete code of a site I did that centers in IE6 but most of
it so if it doesnt work in IE6 I'm sure we can implement the rest of the
code for you.

Just one more thing, you need to watch you padding and margins, they work
different between firefox and IE.


Hope that helps, let me know.

Martin



----- Original Message -----
From: "John Deaville" [EMAIL REMOVED]
To: [EMAIL REMOVED]
Sent: Monday, September 03, 2007 4:53 PM
Subject: Re: FN-FORUM: Css horizontal alignment (mark II)


>
> Thanks for all the replies
>
> I am sure that part of the problem is that I have modified my original
> html
> and css from what started off as another project, when I shjould have just
> started from scratch - which is what I will do when I actually get around
> to
> redesigning the site proper
>
> And then I am sure I will be asking you more questions !
>
> Thanks again
>
>
> john
>
>
> --
> Freelancers, contractors earn more with Prosperity4
> Call 0870 870 4414 or visit www.prosperity4.com
> and benefit from Inland Revenue approved expenses today.
>
> To advertise here: http://www.freelancers.net/advertising.html
>
>



Messages by Day
September 30th 2007
September 29th 2007
September 28th 2007
September 27th 2007
September 26th 2007
September 25th 2007
September 24th 2007
September 23rd 2007
September 22nd 2007
September 21st 2007
September 20th 2007
September 19th 2007
September 18th 2007
September 17th 2007
September 16th 2007
September 15th 2007
September 14th 2007
September 13th 2007
September 12th 2007
September 11th 2007
September 10th 2007
September 9th 2007
September 8th 2007
September 7th 2007
September 6th 2007
September 5th 2007
September 4th 2007
September 3rd 2007
September 2nd 2007
September 1st 2007


Messages by Month
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007


Messages by Year
2008
2007
2006
2005
2004
2003
2002
2001
2000