Solved

Simple CSS drop-down menu positioning

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

Network ports are the threads that hold network communication together. They are an essential part of networking that can be easily ignore or misunderstood, my goals is to show those who don't have a strong network foundation how network ports opera…
This article explains how to prepare an HTML email signature template file containing dynamic placeholders for users' Azure AD data. Furthermore, it explains how to use this file to remotely set up a department-wide email signature policy in Office …
In this tutorial viewers will learn how to style a corner ribbon overlay for an image using CSS Create a new class by typing ".Ribbon":  Define the class' "display:" as "inline-block": Define its "position:" as "relative": Define its "overflow:" as …
In this tutorial viewers will learn how to embed videos in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <video> tag to insert a video. Define the src as the URL of your video; this is similar to …

758 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

21 Experts available now in Live!

Get 1:1 Help Now