Solved

CSS question

Posted on 2012-03-16
8
197 Views
Last Modified: 2012-03-16
I am having some trouble styling a link. I need to create a "float:right" on the last-menu-item class

class="last-menu-item menu-item menu-item-type-taxonomy menu-item-object-category menu-item-33"

I cannot figure out where to insert this - all my efforts are failing. Any ideas?

<div class="menu-main-navigation">
    <ul id="menu-main-navigation" class="menu">
        <li id="menu-item-35" class="menu-item menu-item-type-post_type menu-item-object-page menu-item-35"><a href="#">About us</a><cite></cite></li>
        <li id="menu-item-29" class="menu-item menu-item-type-taxonomy menu-item-object-category menu-item-29"><a href="#">Entertaining</a><cite></cite></li>
        <li id="menu-item-33" style="last-menu-item menu-item menu-item-type-taxonomy menu-item-object-category menu-item-33"> <a href="#">Last Link</a><cite></cite></li>
        </li>
    </ul>
</div>

Open in new window


Here is the CSS:

/*------------------------------------------------*/
/*---------------[MAIN NAVIGATION]------------*/
/*------------------------------------------------*/
	ul#menu-main-navigation { border-bottom:1px solid #d1d1bd; border-top:1px solid #d1d1bd;height:27px; margin: 0 auto; padding-top:3px; position: relative; width:945px; }
		ul#menu-main-navigation li { float:left; margin-right:5px; padding:2px 0 0 0; height:26px; width:auto; }
			ul#menu-main-navigation li a { font-family:Museo500, "Helvetica Neue", Helvetica, Arial, sans-serif; padding:8px 12px 7px; font-size: 13px; color: #49413c;}
			ul#menu-main-navigation li a:hover { color: #49413c !important; text-decoration:underline !important; }
			ul#menu-main-navigation li a:active { color:#d9461e !important;text-decoration:underline; }
				ul#menu-main-navigation li#menu-item-35 { padding-left:2 !important; }
				ul#menu-main-navigation li.current-menu-item a, ul#menu-main-navigation li.current-menu-item a:hover { background:url(images/nav-start.png) no-repeat 0 3px transparent; color:#ffffff !important; padding:5px 0 6px 12px; }
				ul#menu-main-navigation li.current-menu-item cite { background:url(images/nav-end.png) no-repeat right 0 transparent; display:block; float:right; height:21px; left:-1px; position:relative; width:12px; }
				ul#menu-main-navigation li.current-menu-item cite { top: 1px\9; }  /* IE8 */
				ul#menu-main-navigation li.current-menu-item cite { position:relative\9; }  /* IE8 */
				:root ul#menu-main-navigation li.current-menu-item cite { top: 1px \0/IE9; }  /* IE9 */
				:root ul#menu-main-navigation li.current-menu-item cite { position:relative; \0/IE9; }  /* IE9 */
				ul#menu-main-navigation li.current-menu-item a:hover { cursor:default; text-decoration:none !important; }
/*------------------------------------------------*/
/*---------------[CATEGORIES DROPDOWN]------------*/
/*------------------------------------------------*/
	ul#cats-menu, #menu-main-navigation { border-bottom:1px solid #d1d1bd; border-top:1px solid #d1d1bd;height:30px; margin: 0 auto; position: relative; width:940px; }
		ul#cats-menu li, #menu-main-navigation li { margin-right: 5px; padding-left: 12px; height: 37px;}
			ul#cats-menu li a, #menu-main-navigation li a { font-family:Museo500, "Helvetica Neue", Helvetica, Arial, sans-serif; padding:4px 8px 7px 0; font-size: 13px; color: #49413c;}
				ul#cats-menu li a:hover, #menu-main-navigation li a:hover { color: #22b7c9; text-decoration: none; }
	ul#cats-menu li li { background:#313131; background-image:none; margin:0; padding: 0px; width: 240px; }
		ul#cats-menu li li a { background: none; text-align: left; height:auto; padding:10px 12px; display: block; width: 216px;}
	#cats-menu ul { background-image: url(images/categories-bottom.png); padding-bottom: 18px; }
	#cats-menu li:hover ul, ul#cats-menu li.sfHover ul { top:37px; }
		#cats-menu li li { background-image: none; margin: 0px; }
	ul#cats-menu > li:hover { color:#22b7c9; padding-left: 12px; }
		ul#cats-menu > li:hover > a {  }
			#cats-menu li li a:hover { background-color: #242424; border: none; }
			#cats-menu li li:hover ul, ul#cats-menu li li.sfHover ul { top:0px; }


  

Open in new window

0
Comment
Question by:lvollmer
[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
  • 3
  • 3
  • 2
8 Comments
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 37730746
I'm not surprised you can't find the right spot.  Did you ever hear the expression "keep it simple"?

The CSS is terrible.

You saved a little typing by not applying ids to elements, and then doing a bunch of nesting.  That litle bit you saved is now costing you big time in maintenance.

You you want to target an element, then give it an id and do it directly.

Then go back to your CSS and re-think the mis-guided notion that you save something by creating a rat's nest in the CSS.


Cd&
0
 

Author Comment

by:lvollmer
ID: 37730754
Yeah, no kidding - The code is generated by a CMS, I cannot alter the HTML that is output, I can only alter the CSS.
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 37730770
Then your best hope is to use firefox.  Right click on the element and inspect it. You will be able to get the style, and you may be able to determine where it is ultimately inheriting from.

Cd&
0
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 37730787
BTW any CMS that generates code like that is crap.  Four classes assigned to an element... WOW!


Cd&
0
 
LVL 30

Expert Comment

by:LZ1
ID: 37730849
Is this WordPress?  Do you have a live link you can share?

The CSS is definitely over-bloated.  I never let anyone or anything write my code for me and CMS's are no exception.
0
 

Author Comment

by:lvollmer
ID: 37730879
Yes it is Wordpress - here is the link > http://tinyurl.com/757mp88

I am stuck using this theme some company built, rebuilding is not an option at the moment although I have recommended it many times.
0
 
LVL 30

Accepted Solution

by:
LZ1 earned 500 total points
ID: 37730887
Do something like this:
 
ul#menu-main-navigation li.last-menu-item{float:right;}

Open in new window

0
 

Author Closing Comment

by:lvollmer
ID: 37730902
Jackpot! thanks. saved me a bunch more time.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
CSS (jquiry mobile) question 3 34
object method as an event handler 8 75
Set css in function 11 54
Error Handler 8 42
This article describes how to create custom column layout styles for Bootstrap. The article uses 5 columns to illustrate the concept, but the principle can be extended to any number of columns.
Building a website can seem like a daunting task to the uninitiated but it really only requires knowledge of two basic languages: HTML and CSS.
In this tutorial viewers will learn how to style rounded corners for elements in CSS using the border-radius property Begin with a normal styled element such as a div: To style all four corners of the div to be the same degree of roundness, use the …
In this tutorial viewers will learn how to embed custom externally-hosted Google Fonts using the Google Font API in CSS Go to the Google Fonts website at google.com/fonts: Browse or search based on font properties or name to find a suitable font for…

734 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