Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

CSS question

Posted on 2012-03-16
8
Medium Priority
?
201 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
  • 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
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!

 
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 2000 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

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

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 …
Originally, this post was published on Monitis Blog, you can check it here . Websites are getting bigger and more complicated by the day. Video, images and custom fonts are all great for showcasing your product or service. But the price to pay in…
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 …
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses

927 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