Solved

CSS question

Posted on 2012-03-16
8
194 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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

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.

 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

Suggested Solutions

Title # Comments Views Activity
html input 8 42
Need HTML output in powershell line by line 3 27
Html Newline 7 20
Set time on Session (ASP) 14 21
Preface This is the third article about the EE Collaborative Login Project. A Better Website Login System (http://www.experts-exchange.com/A_2902.html) introduces the Login System and shows how to implement a login page. The EE Collaborative Logi…
This article discusses four methods for overlaying images in a container on a web page
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

808 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