Page 1 of 1
need some help centering div with css
Posted: Sun 20 Jun 2010 2:33 am
by n9mfk
Hi all i need some help
i am trying to center all div on all my page it making my eye

i like some help to see if there centered thanks beau
http://www.n9mfk.com/
Re: need some help centering div with css
Posted: Sun 20 Jun 2010 5:56 am
by DaveNZ
To centre everything in a div element you could use
Or, to centre a div element in the page without making the content inside it centred, you could use this (as an example)
Code: Select all
div {
width: 500px;
margin: auto;
}
Re: need some help centering div with css
Posted: Sun 20 Jun 2010 2:22 pm
by n9mfk
come up with width is the problem im having
Beau
Re: need some help centering div with css
Posted: Sun 20 Jun 2010 7:41 pm
by daj
n9mfk wrote:come up with width is the problem im having
What do you mean? Are you not sure what width to pick?
Re: need some help centering div with css
Posted: Sun 20 Jun 2010 9:31 pm
by n9mfk
Hi David,
what i mean is if i do this
Code: Select all
div {
width: 500px;
margin: auto;
}
i never sure what number to us for width
Beau
Re: need some help centering div with css
Posted: Sun 20 Jun 2010 9:46 pm
by DaveNZ
n9mfk wrote:Hi David,
what i mean is if i do this
Code: Select all
div {
width: 500px;
margin: auto;
}
i never sure what number to us for width
Beau
You could always experiment by trying different numbers and see what you are happy with
