|
| |
|
|
RickP
Posts: 728 Joined: 11/13/2004 From: Kent, U.K. Status: offline
|
center aligning objects - not text? - 9/21/2005 9:28:56
How does one CENTER align an object - not text - with css? The only centering format in CSS I can find is {text-align: center:} What if I want to center align a table but I don't want everything in it centered? <div align="center"> before the table works but it doesn't validate under the strict doc type ???
_____________________________
Regards, Rick On-The-Web-Now!
|
|
|
|
caz
Posts: 3731 Joined: 10/10/2001 From: Somewhere south of Chester, UK Status: offline
|
RE: center aligning objects - not text? - 9/21/2005 9:41:22
Do you have a url for this page?
_____________________________
I remember when it took less than 4hrs to fly across the Atlantic. http://www.ambradirect.com
|
|
|
|
davidrandall
Posts: 76 Joined: 7/28/2005 Status: offline
|
RE: center aligning objects - not text? - 9/21/2005 9:59:44
in your CSS:
table {
width: 80%;
margin: auto;
} (edit) Hit submit too quickly! quote:
<div align="center"> before the table works but it doesn't validate under the strict doc type The "align" element is deprecated. That means that it is outdated and there is a better way to achieve the same effect (by using CSS) Hope that helps Dave
< Message edited by davidrandall -- 9/21/2005 10:09:42 >
|
|
|
|
coreybryant
Posts: 2614 Joined: 3/17/2002 From: Castle Rock CO USA Status: offline
|
RE: center aligning objects - not text? - 9/21/2005 11:16:49
You can also try <div style="margin:0 auto;width:770px">
_____________________________
Corey R. Bryant My Merchant Account Blog | Expression Web Blog
|
|
|
|
RickP
Posts: 728 Joined: 11/13/2004 From: Kent, U.K. Status: offline
|
RE: center aligning objects - not text? - 9/21/2005 14:00:12
Thanks All, The {margin: auto;} seems to have done the trick (with or without the added "0") in the 4 browser tests I've made. Er... can someone explain why "auto" center aligns things? Or does it always? I'm still having a problem trying to center a CSS horizontal nav bar though. Any further help here appreciated. Here's the code thus far: #navcontainer
{ margin-top: 2px; padding: 0 0 0 0px; }
#navcontainer UL
{ list-style: none; margin: 0; padding: 0; border: none; }
#navcontainer LI
{ display: block; margin: 1px; padding: 0; float: left; width: 186px; text-align: center; }
#navcontainer A
{ color: #111111; display: block; width: auto; text-decoration: none; background: #75A3D1; font-size:10px; font-weight: bold;
margin: 0; border-left: 1px solid #EEEEEE; border-top: 1px solid #EEEEEE; border-right: 1px solid #777777;
border-bottom: 2px solid #777777; padding-left:1; padding-right:1; padding-top:4; padding-bottom:4; }
#navcontainer li A:hover, #navcontainer li A:active
{ background: #88AA33; }
#navcontainer li a:link.active, #navcontainer li a:visited.active
{ position: relative; z-index: 102; background: #BBBBBB; font-weight: bold; }
#homepage #nav-homepage, #ironmongery #nav-ironmongery, #signs #nav-signs, #contact #nav-contact
{ background: #88AA33; } And the HTML: <div id="navcontainer">
<ul id="navlist">
<li><a href="../../" title="zzz">Temple Graphics - Home</a></li>
<li><a href="../../" title="zzz">Architectural Ironmongery</a></li>
<li><a href="../../" title="zzz">Bespoke Signage</a></li>
<li><a href="../../" title="zzz">Messages & Enquiries</a></li>
</ul> </div> Thanks for any offers
_____________________________
Regards, Rick On-The-Web-Now!
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|