?
Solved

Simple CSS drop-down menu positioning

Posted on 2012-03-29
2
Medium Priority
?
510 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 2000 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

WordPress Tutorial 1: Installation & Setup

WordPress is a very popular option for running your web site and can be used to get your content online quickly for the world to see. This guide will walk you through installing the WordPress server software and the initial setup process.

Question has a verified solution.

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

Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Suggested Courses
Course of the Month14 days, 9 hours left to enroll

770 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