Solved

Simple CSS drop-down menu positioning

Posted on 2012-03-29
2
508 Views
Last Modified: 2012-03-30
Dear EE community,

I have an incredibly simple CSS drop-down menu. However, I'm having trouble putting text either side of it. Any ideas?

Thanks in advance.

/* simple drop down menu - CSS */
#sddm
{	margin: 0;
	padding: 0; display:inline;
	z-index: 30;
}

#sddm li
{	list-style: none;
	float: left; 
}


#sddm li a
{	
	margin: 0 1px 0 0;
	padding: 4px 10px;
	width: 10px;
	color:#FFFFFF;
	text-align: center;
	text-decoration: none;
}

#sddm li a:hover {	
        background:#000000;
	color:#FFFFFF;
}

#sddm div {
	position: absolute;
	visibility: hidden;
	margin: 0;
	padding: 0;
	background: #FFFFFF;
	border: 1px solid #000000;
	z-index: 2;
}

#sddm div a {	
        position: relative;
	display: block;
	margin: 0;
	padding: 5px 10px;
	width: auto;
	white-space: nowrap; 
	text-align: left;
	text-decoration: none;
	background:#FFFFFF;
	color:#000000;
	z-index:2;
}

#sddm div a:hover {	
        background:#000000;
	color: #FFF;
}

Open in new window


<!--  simple drop down menu - HTML -->
<!-- not bothered to include the javascript as this is a CSS issue but can if it is required -->

<div class="FeedAmount">
show <ul id="sddm"><li><a onmouseover="mopen('m1')" onmouseout="mclosetime();"><?php echo $limit.'&nbsp;&#x25BC;'; ?></a>
        				<div id="m1" onmouseover="mcancelclosetime();" onmouseout="mclosetime();">
						<a href="<?php echo $_SERVER['PHP_SELF'].'?code='.$code.'&feed=25'; ?>">25</a>
						<a href="<?php echo $_SERVER['PHP_SELF'].'?code='.$code.'&feed=50'; ?>">50</a></div></li></ul> posts
</div>

Open in new window


So, in this example, I would like it to say "show <drop down menu here> posts" , if this is possible.
0
Comment
Question by:BenthamLtd
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 42

Accepted Solution

by:
David S. earned 500 total points
ID: 37784911
The simplest solution would be to put the word (or group of words) before and after the menu each in a <span> and then float the <span>s.

The more complicated solution would be to use display:inline-block (which requires a bit of work to support older browsers).
http://www.search-this.com/2008/08/28/lets-all-get-inline-in-a-block-in-a-block/
http://gtwebdev.com/workshop/layout/inline-block-gallery.php
http://blog.mozilla.com/webdev/2009/02/20/cross-browser-inline-block/

P.S. I suggest you consider making your menu usable for people who navigate with the keyboard.
0
 

Author Closing Comment

by:BenthamLtd
ID: 37786054
Worked a treat, many thanks. Simply slapped a <span style="float:left;"></span> around each word.

And yes, I'll take into consideration keyboard navigation.
0

Featured Post

Building an interactive eFuture classroom

Watch and learn how ATEN provided a total control system solution including seamless switching matrix switch, HDBaseT extenders, PDU, lighting control to build an interactive eFuture classroom.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When it comes to write a Context Sensitive Help (an online help that is obtained from a specific point in state of software to provide help with that state) ,  first we need to make the file that contains all topics, which are given exclusive IDs. …
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

705 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question