Avatar of Larry Vollmer
Larry Vollmer
 asked on

CSS question

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

HTMLCSSWeb Languages and Standards

Avatar of undefined
Last Comment
Larry Vollmer

8/22/2022 - Mon
COBOLdinosaur

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&
Larry Vollmer

ASKER
Yeah, no kidding - The code is generated by a CMS, I cannot alter the HTML that is output, I can only alter the CSS.
COBOLdinosaur

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&
Your help has saved me hundreds of hours of internet surfing.
fblack61
COBOLdinosaur

BTW any CMS that generates code like that is crap.  Four classes assigned to an element... WOW!


Cd&
LZ1

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.
Larry Vollmer

ASKER
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.
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.
ASKER CERTIFIED SOLUTION
LZ1

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Larry Vollmer

ASKER
Jackpot! thanks. saved me a bunch more time.