Solved

CSS Class Names and proper identification

Posted on 2012-04-11
3
173 Views
Last Modified: 2012-04-30
Hi -

We have a website where the HTML is being generated from the CMS system.  As such - the class names for various parts are predictable.

For example - we have a menu where the menu options are along the lines of:

<li class="leaf">
<a href="#">First menu item</a>
</li>
<li class="leaf">
<a href="#">Second menu item</a>
</li>
<li class="leaf last">
<a href="#">Last menu item</a>
</li>

What would the CSS line be to identify anything with "leaf" and "a"?

Sort of a generic..

.leaf a { }

?
0
Comment
Question by:erzoolander
  • 2
3 Comments
 
LVL 30

Expert Comment

by:LZ1
ID: 37832930
That would work.

You could also do li.leaf a{}
0
 
LVL 1

Author Comment

by:erzoolander
ID: 37833001
And that would cover the "leaf last" classname as well?
0
 
LVL 30

Accepted Solution

by:
LZ1 earned 500 total points
ID: 37833006
If you want to do both leaf and last classes then do this:

li.leaf.last a{}

Open in new window

0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

CSS is a visual language used to classify objects and define rules about how they should be displayed. CSS skills aren’t restricted to developers anymore, there is a big benefit to having a basic understanding of the language, regardless of your occ…
Why do we like using grid based layouts in website design? Let's look at the live examples of websites and compare them to grid based WordPress themes.
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…
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 …

707 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

21 Experts available now in Live!

Get 1:1 Help Now