...

View Full Version : how do you get DIV borders?



whizard
02-07-2005, 10:09 PM
how can you get a 1px #999999 border around a div?
and, whats the best way to center it?

Thanx, Dan

Fashong
02-07-2005, 10:24 PM
I do not know what you mean by div border but I will give it a shot...

<div style="border: 1px solid #000000;">
</div>

whizard
02-07-2005, 10:29 PM
Thanx, thats what I meant. Ill try to be clearer next time

Dan

_Aerospace_Eng_
02-07-2005, 10:30 PM
yes fashongs way will work, best way to center a div would be margin:auto

<div style="border:1px solid #999999;margin:auto;width:500px;">your text</div>
in IE u will need a valid doctype for margin:auto; to work, and in some cases you will need to add height to the div using css for browsers such as FF

rmedek
02-07-2005, 11:36 PM
how can you get a 1px #999999 border around a div?
and, whats the best way to center it?

Don't forget, you can also use classes or ids to clean things up a bit...

CSS:

.centered {
margin: 0 auto;
border: solid 1px #999;
padding: 5px;
}

HTML:

<div class="centered">texty text</div>

Hope this helps,

whizard
02-08-2005, 05:42 PM
Thanks All!

I just had a momentary blank, and needed refreshing!

Dan



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum