Sam
Sam

Reputation: 6364

Select link of certain class within body of certain class

What is the correct way to select a link of a certain class within a body of specific class. For example my body has the class "abc" and my link has the class "efg", what would my css code look like? (I'm trying to create active links for a Magento block)

Upvotes: 0

Views: 74

Answers (4)

Narendra
Narendra

Reputation: 3117

Check this example

<html> 
<head>      
<style>
.outer
{
    background-color: red;
    height: 40px;
    margin: 10px;
}

.inner
{
    background-color: blue;
    height: 20px;
    margin: 5px;
}

.outer .inner
{
background-color: green;
}
</style>
</head>

<body  onload="loadCars()">

Check div style.
<div  id="mydiv" class="inner">
</div>

</div>
<div  id="mydiv" class="outer">
<div  id="mydiv" class="inner"></div>

</div>

</body>
</html>

Save the above code in an html file and open it.

Upvotes: 0

Ahsan Khurshid
Ahsan Khurshid

Reputation: 9469

You should write something like this:

.abc .efg {

     /*Your CSS Rules*/
 }

SEE DEMO

Upvotes: 0

Ibu
Ibu

Reputation: 43850

You have to do some research

body.abc a.efg {
   rules
}

even w3c can help you with that

Upvotes: 0

Ariel
Ariel

Reputation: 26783

body.body_class a.link_class

This question is a bit basic - you should try to learn this stuff a bit.

Upvotes: 1

Related Questions