Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

CSS Forum


You are currently viewing our CSS Forum as a guest. Please register to participate.
Login



Reply
drop menu won't center
Old 01-05-2010, 09:54 PM drop menu won't center
Junior Talker

Posts: 2
Trades: 0
I've been trying for a couple days off and on to get this drop menu to center, but no matter what I do it always sits to the far left.
The webpage is www.saegmu.com

css code:
Code:
#sddm
{	
position: absolute;
text-align:center;
margin: 0 auto;
	padding: 0;
	z-index: 30}

#sddm li
{	
text-align:center;
margin: 0;
	padding: 0;
	list-style: none;
	float: left;
	font: bold 11px arial;}
	

#sddm li a
{	display: block;
	margin: 0 1px 0 0;
	padding: 4px 5px;
	background: #5970B2;
	color: #FFF;
	text-align: center;
	text-decoration: none}

#sddm li a:hover
{	background: #49A3FF}

#sddm div
{	visibility: hidden;
	margin: 0;
	padding: 0;
	background: #EAEBD8;
	border: 1px solid #5970B2}

	#sddm div a
	{	position: center;
		display: block;
		margin: 0;
		padding: 5px 10px;
		width: auto;
		white-space: nowrap;
		text-align: left;
		text-decoration: none;
		background: #EAEBD8;
		color: #2875DE;
		font: 11px arial}

	#sddm div a:hover
	{	background: #49A3FF;
		color: #FFF}
js code:
Code:
var timeout         = 500;
var closetimer		= 0;
var ddmenuitem      = 0;

// open hidden layer
function mopen(id)
{	
	// cancel close timer
	mcancelclosetime();

	// close old layer
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';

	// get new layer and show it
	ddmenuitem = document.getElementById(id);
	ddmenuitem.style.visibility = 'visible';

}
// close showed layer
function mclose()
{
	if(ddmenuitem) ddmenuitem.style.visibility = 'hidden';
}

// go close timer
function mclosetime()
{
	closetimer = window.setTimeout(mclose, timeout);
}

// cancel close timer
function mcancelclosetime()
{
	if(closetimer)
	{
		window.clearTimeout(closetimer);
		closetimer = null;
	}
}

// close layer when click-out
document.onclick = mclose;
html code:
Code:
<ul id="sddm">  
    <li><a href="index.php">Home</a></li>
    <li><a href="#" 
        onmouseover="mopen('m2')" 
        onmouseout="mclosetime()">About</a>
        <div id="m2" 
            onmouseover="mcancelclosetime()" 
            onmouseout="mclosetime()">
        <a href="About_SAE.php">About SAE</a>
        <a href="What_is_Rush.php">What is Rush?</a>
        </div>
    </li>
    <li><a href="Upcoming_Events.php">Upcoming Events</a></li>
    <li><a href="Brother_Directory.php">Brother Directory</a></li>
    <li><a href="Alumni.php">Alumni</a></li>
    <li><a href="Photos.php">Photos</a></li>
    <li><a href="#" 
        onmouseover="mopen('m3')" 
        onmouseout="mclosetime()">Links</a>
        <div id="m3" 
            onmouseover="mcancelclosetime()" 
            onmouseout="mclosetime()">
        <a href="Links.php">External Links</a>
        <a href="Construction.php">Contact Us</a>
        </div>
        </li>
        <li><a href="members.php">Members</a></li>
</ul>
If I could get any help towards centering this ul it would be greatly appreciated. I've tried <center> <p align="center"> and other various tags, but all were a no go.
snidd111 is offline
Reply With Quote
View Public Profile
 
 
Register now for full access!
Old 01-06-2010, 05:57 AM Re: drop menu won't center
WebDizanSajtova's Avatar
Average Talker

Posts: 23
Name: Miloš Krčedinac
Location: Novi Sad, Serbia
Trades: 0
Snidd111,

<div id="centering-drop-menu"></div>

#centering-drop-menu {
margin: 0 auto;
}
__________________

Please login or register to view this content. Registration is FREE
I
Please login or register to view this content. Registration is FREE
I
Please login or register to view this content. Registration is FREE
I
Please login or register to view this content. Registration is FREE
I
Please login or register to view this content. Registration is FREE

WebDizanSajtova is offline
Reply With Quote
View Public Profile Visit WebDizanSajtova's homepage!
 
Old 01-06-2010, 07:50 PM Re: drop menu won't center
LadynRed's Avatar
Defies a Status

Posts: 10,017
Location: Tennessee
Trades: 0
There's only one thing wrong with that example - in order for the margin: 0 auto to work you MUST define a width!

Oh, one thing, there is no such thing as position: center!
__________________
Web Goddess & Web Standards Evangelist :) - Tables Be Gone !!

Please login or register to view this content. Registration is FREE


Please login or register to view this content. Registration is FREE

LadynRed is offline
Reply With Quote
View Public Profile
 
Old 01-07-2010, 03:16 PM Re: drop menu won't center
Junior Talker

Posts: 2
Trades: 0
thanks ladynred. i believe i noticed that when i put it in but forgot to take it out. like i said i'd been working on code for quite a while and i was becoming a little snowblind in a sense.
However, with the code you gave WebDizanSajtova, adding the width:0; segment, it now starts from the center rather than being centered. so that didn't totally solve the problem although progress is being made at least.
snidd111 is offline
Reply With Quote
View Public Profile
 
Reply     « Reply to drop menu won't center
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.91451 seconds with 12 queries