Solved

Css Drop Down Menu

Posted on 2013-01-18
7
625 Views
Last Modified: 2013-01-18
Hi experts,

I'm trying to use a css drop down menu into my website.

Here are the source : Css3 Drop Down Menu .

Here are my troubles :
- the 4th last menu, start at "products", marked with the class "menu_right" ; must be aligned at the left of the container (<ul>) but it don't work.
- the top menus marked with class "drop" don't work too : normally a small picture (an arrow - drop.png) must be showed at the right of the menu, to indicate that a submenu exists.

How it should be :
menu-prototype.tiff

How it is now:
 menu-now.tiff

Do you have an idea what's wrong ?

I have applied all the css & html code as follow :
- css : the same code as the final example except the width of the menu
#menu
{
	/*width: 940px;*/
	width: 90%;
}

Open in new window


- html :
<ul id="menu">
	<li> <!--- index group (Home) --->
		<cfinvoke returnvariable="variables.indexPages"		component="tools.pagesTools" method="getPages" group="index">
		<cfloop array="#variables.indexPages#" index="variables.page">
			<cfif variables.page.getPosition() NEQ 0>
				<cfset variables.pageName = uCase(variables.page.getTitle())>
				<cfoutput> <a class="navigationBarLink" href="#variables.page.getUrl()#" onclick="processing();">#variables.pageName#</a> </cfoutput>
			</cfif>
		</cfloop>
	</li>
		
	<li> <!--- company group (About Joe Cool) --->
		<a class="drop">ABOUT JOE COOL</a>
		<div class="dropdown_2columns">
			<cfinvoke returnvariable="variables.companyPages"	component="tools.pagesTools" method="getPages" group="company">
			<cfloop array="#variables.companyPages#" index="variables.page">
				<cfif variables.page.getPosition() NEQ 0>
					<cfset variables.pageName = uCase(variables.page.getTitle())>
					<div class="col_2">
						<cfoutput> <a class="navigationBarLink" href="#variables.page.getUrl()#" onclick="processing();">#variables.pageName#</a> </cfoutput>
						<hr />
					</div>
				</cfif>
			</cfloop>
		</div>
	</li>
		
	<li class="menu_right"> <!--- products group (Products) --->
		<a class="drop">PRODUCTS</a>
		<div class="dropdown_3columns"> <!--- align_right --->
			<cfinvoke returnvariable="variables.productsPages"	component="tools.pagesTools" method="getPages" group="products">
			<cfloop array="#variables.productsPages#" index="variables.page">
				<cfif variables.page.getPosition() NEQ 0>
					<cfset variables.pageName = uCase(variables.page.getTitle())>
					<div class="col_3">
						<cfoutput> <a class="navigationBarLink" href="#variables.page.getUrl()#" onclick="processing();">#variables.pageName#</a> </cfoutput>
						<hr />
					</div>
				</cfif>
			</cfloop>
		</div>
	</li>
		
	<li class="menu_right"> <!--- best sellers link --->
		<a class="navigationBarLink" href="/fashion/jewellery/Products.cfm?" onclick="processing();"> <cfoutput>BEST SELLERS</cfoutput> </a>
	</li>
		
	<li class="menu_right"> <!--- new items link --->
		<a class="navigationBarLink" href="/fashion/jewellery/Products.cfm?" onclick="processing();"> <cfoutput>NEW ITEMS</cfoutput> </a>
	</li>
		
	<li class="menu_right"> <!--- search box --->
		<a>
			<cfform action="/fashion/jewellery/search.cfm" method="post" id="navigationBarSearch" onsubmit="return validate();">
				<cfoutput> <cfset variables.searchLabel = ormExecuteQuery("from Page where page = 'Search' AND cfcName like '%_#session.language#'")> </cfoutput>
				<cfinput type="text" name="userSearch" maxlength="100" value="Enter keyword(s) here">
				<cfinvoke returnvariable="variables.javascript" component="javascripts.javascriptsTools" method="validateInput" controlName="userSearch" isRequired="true" 
								controlLabelValue="#variables.searchLabel[1].getTitle()#" maxLength="100" minLength="1" isAlphaNumericOnly="true">
				<cfoutput>#variables.javascript#</cfoutput>
				<cfinput type="submit" name="submitSearch" value="#variables.searchLabel[1].getTitle()#" onclick="processing();">
				<cfinput type="hidden" name="validate" value="search">
			</cfform>
		</a>
		
		<script type="text/javascript">
			function validate()
			{
				if(validate_userSearch())
				{
					return true;
				}
				return false;
			}
		</script>
	</li>
</ul>

Open in new window


I attach the both concerned files ("2_navigationBar.cfm" -> renamed in "2_navigationBar.cfm.txt" & "navigationBar.css")
I also attache a print screen of the look of my menu now (menu_now.tiff) & a prototype of how it should be (menu_prototype.tiff).

Well, the code is in html & coldfusion, but no matter, it works fine, just the css who does tricks to me :-)
The coldfusion code just retrieve the different page names.

Thanks a lot.
navigationBar.css
2-navigationBar.cfm.txt
0
Comment
Question by:adam1h
  • 4
  • 3
7 Comments
 
LVL 30

Expert Comment

by:LZ1
ID: 38793666
Anyway we can see a live link?
0
 

Author Comment

by:adam1h
ID: 38793727
Hi LZ1,

Yes, you could see it at Live view

Regards.
0
 
LVL 30

Accepted Solution

by:
LZ1 earned 500 total points
ID: 38793740
First for the arrow issue:
This class should have some type of background image #menu li .drop.  Otherwise it won't show anything indicating a drop down.

Then the .menu_right class should have float:right;.  Did you copy the CSS exactly?
0
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

Author Comment

by:adam1h
ID: 38793844
Thanks for your comment.

Yes I have copied the css exactly, I just have changed the #menu width

I'll double check.
0
 

Author Comment

by:adam1h
ID: 38793894
The #menu li .drop class has a backgroung image :
#menu li .drop
{
	padding-right: 21px;
	background: url(/pictures/graphics/drop.png) no-repeat rightright 8px;
}
#menu li:hover .drop
{
	background: url(/pictures/graphics/drop.gif) no-repeat rightright 7px;
}

Open in new window

What do you mean exactly ?



The ..menu_right now runs well ; I have correct the code.
It was :
#menu .menu_right
{
	float: rightright;
	margin-right: 0px;
}

Open in new window


It is now :
#menu .menu_right
{
	float: right;
	margin-right: 0px;
}

Open in new window


Don't now why it was rightright.

Thanks for that.
0
 

Author Comment

by:adam1h
ID: 38793909
I have corrected other rightright, and now the arrow show good.

Thank you a thousand time for your precious help LZ1.
0
 
LVL 30

Expert Comment

by:LZ1
ID: 38794001
Glad to help
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
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 elements, such a divs, with a "drop shadow" effect using the CSS box-shadow property Start with a normal styled element, such as a div.: In the element's style, type the box shadow property: "box-shad…
In this tutorial viewers will learn how to customize the background color and font color of highlighted text using the ::selection element in CSS Begin by defining the selected text as an element in CSS by typing "::selection": Style the ::selection…

864 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

16 Experts available now in Live!

Get 1:1 Help Now