logo-dw

Go Back   Dreamweaver Club Forums > Hand Coders Forum > HTML and CSS
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 10-22-2011, 02:23 PM   #1
toffeeguitar
 
Join Date: Oct 2011
Posts: 6
Default CSS code style sheet - why wont it align centre?!

Hi All,

Have created the below code for a horizontal menu bar which i want to be centered... please can you tell me what i need to add/change to make this work?

* { padding: 0; margin: 0; }
body { padding: 5px; font-family:Arial, Helvetica, sans-serif; font-size:12px }
ul { list-style: none }
ul li { float: left; padding-right: 1px; position: relative; }
ul a { display: table-cell; vertical-align: middle; width: 186px; height: 30px; text-align: center; color: #666; text-decoration: none; }
ul a:hover { color: #000; background-image:url(../images/menu-selected.jpg) }
li > ul { display: none; position:absolute; left: 0; top: 100%; }
li:hover > ul { display: block; color: #000; background-image:url(../images/menu-hover.jpg); }
li > ul li { padding: 0; padding-top: 1px; }
li > ul li > ul { left: 100%; top: 0; padding-left: 1px; }
li > ul li > ul li { width: 186px; }
li:hover > a { color: #000; background-image:url(../images/menu-selected.jpg); }
</style>

Thanks,

Joe
toffeeguitar is offline   Reply With Quote
Old 10-22-2011, 05:12 PM   #2
DWcourse
DWcourse's Avatar
 
Join Date: Apr 2009
Posts: 3,276
Default

You can center an html object with CSS by giving it a width and setting the left and right margins to auto.

However, which object you choose to center, will depend on the rest of your page layout.
__________________
If my answer helped, check out DWcourse.com for Dreamweaver tips and tutorials.
DWcourse is offline   Reply With Quote
Old 10-22-2011, 08:10 PM   #3
toffeeguitar
 
Join Date: Oct 2011
Posts: 6
Default

Sorry, im a bit of a newb when it comes to this...

Can you give me step by step details please? I have attached my files incase its easier for you to edit!?!

Thanks so much.
Attached Files
File Type: zip zip.zip (3.4 KB, 0 views)
toffeeguitar is offline   Reply With Quote
Old 10-22-2011, 08:43 PM   #4
DWcourse
DWcourse's Avatar
 
Join Date: Apr 2009
Posts: 3,276
Default

Sorry, most people won't open posted zip files because of security issues. In any case here's a video that might help: http://www.dwcourse.com/dreamweaver/...web-layout.php
__________________
If my answer helped, check out DWcourse.com for Dreamweaver tips and tutorials.
DWcourse is offline   Reply With Quote
Old 10-22-2011, 09:21 PM   #5
toffeeguitar
 
Join Date: Oct 2011
Posts: 6
Default

Thanks, will have a look at that
toffeeguitar is offline   Reply With Quote
Old 10-22-2011, 10:56 PM   #6
toffeeguitar
 
Join Date: Oct 2011
Posts: 6
Default

worked a treat! thank you!
toffeeguitar is offline   Reply With Quote
Reply


Thread Tools
Display Modes

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

Forum Jump


All times are GMT. The time now is 11:59 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com