Styling all anchor tags inside the <td> element

I already have a css section:

.leftMemberCol
{
width:125px;
vertical-align:top; 
padding: 13px;
border-width:0px;
border-collapse:separate;
border-spacing: 10px 10px;
text-align:left;
background-color:#f2f3ea;
}

      

for the td section (left panel). I want all links inside this cell to be green.

is there any syntax like:

.leftMemberCol.a
{
color:#E3E3CA;  
} 

      

or any other suggestions instead of going to each page and wrapping all links around a different class name.

+2


source to share


7 replies


If the color doesn't work, check if it's set earlier in your CSS file for any of the a tag pseudo selectors, i.e.: link, etc.

override them with



.leftMemberCol a:link,
.leftMemberCol a:hover,
.leftMemberCol a:visited,
.leftMemberCol a:active
{
   color: #E3E3CA;  
}

      

+4


source


Just do:

.leftMemberCol a
{
   color:#E3E3CA;  
}

      



This will select all anchor tags nested in an element with class .leftMemberCol

+5


source


replace the last period with a space

.leftMemberCol a {
  style goes here
}

      

The dot indicates the class. The hash indicates id (

 <div id="home"> 

      

can be created with

#home { } 

      

). A regular html element like td or a doesn't need a prefix.

0


source


You are very close. This is how you select the links inside the cell:

.leftMemberCol a
{
   color: #E3E3CA;  
}

      

Read more about selectors here .

Edit:
If the style does not take effect, it is likely because you have a different style defined for more specific links. You can make the style more specific by adding specifiers, for example:

td.leftMemberCol a
{
   color: #E3E3CA;  
}

      

As a last resort, you can also use the directive !important

:

.leftMemberCol a
{
   color: #E3E3CA !important;
}

      

0


source


.leftMemberCol a
{
color:#E3E3CA;  
}

      

must do the trick.

0


source


 .leftMemberCol>a
 {
 color:#E3E3CA;  
 }

      

-1


source


.leftMemberCol a
{
    color:#E3E3CA;  
}

      

This is for all elements <a>

that are descendants.leftMemberCol

-1


source







All Articles