Solved

Simple CSS drop-down menu positioning

Posted on 2012-03-29
2
495 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
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

New! My Passport Wireless Pro Wi-Fi Mobile Storage

Portable wireless storage to offload, edit, and stream anywhere.

High-capacity, wireless mobile storage designed to accompany professional photographers and videographers in the field to easily offload, edit and stream captured photos and high-definition videos.

Question has a verified solution.

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

Suggested Solutions

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
Use these top 10 tips to master the art of email signature design. Create an email signature design that will easily wow recipients, promote your brand and highlight your professionalism.
The viewer will learn the benefit of using external CSS files and the relationship between class and ID selectors. Create your external css file by saving it as style.css then set up your style tags: (CODE) Reference the nav tag and set your prop…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

929 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now