Take the 2-minute tour ×
Stack Overflow is a question and answer site for professional and enthusiast programmers. It's 100% free, no registration required.

I have a list generated by Wordpress plugin. I want to simply remove the first row of the list, that is the elements and through CSS.

This is my html:

<dl>
 <dt class="coffee">Coffee</dt>
  <dd>Black hot drink</dd>
 <dt class="milk">Milk</dt>
  <dd>White cold drink</dd>
</dl> 

I tried display:none but it works only for the <dd>.

share|improve this question
1  
It dos work jsfiddle.net/BBdFn –  Mr. Alien Jun 4 '13 at 5:13
    
Sorry, my question was not that clear (Too bad I can't edit it...) Anyway I solved it by specifying "!important": dd.coffee, dt.coffee {display:none !important;} –  CptNemo Jun 4 '13 at 6:38
add comment

5 Answers

up vote 1 down vote accepted

If you still want the space occupied by first row you can add this to your css:

dt.coffee {
   visibility:hidden;
}

If you want to display as if it wasn't there in the first place :

dt.coffee {
   display:none;
}

In case your definition it's overwritten by a main wordpress style you can check the order of your included css and change it so that your css is the very last included or use !important:

dt.coffee {
   display:none !important;
} 
share|improve this answer
add comment

Are you saying you have multiple dl's and you want to delete only the first one?

dl:first-of-type{display:none;}

Or, are you saying in the dl you want to hide the first dt and the first dd?

dl dt:first-child, dl dt:first-child+dd{display:none;}

Or are you saying you just want to remove specifically the dt and dd where the dt has the class "coffee"?

.coffee, .coffee+dd{display:none;}
share|improve this answer
add comment

why not put it inline?

<dl style="display:none;">
 <dt class="coffee">Coffee</dt>
  <dd>Black hot drink</dd>
 <dt class="milk">Milk</dt>
  <dd>White cold drink</dd>
</dl> 

but it must really work on your current code. if you put the right css style rule like this

dl {
    display: none;
}
share|improve this answer
add comment

Here its should work

Here the demo: http://jsfiddle.net/r5uWX/

Your css should be

dl {
  display: none;
 }

and mention the css path depence up on your code. even if it is not working add !important like

dl {
  display: none !important;
 }
share|improve this answer
add comment

for example if this dl is child of a div element you can use this

    div.exampleclass dl:first-child {
       display : none
   }

for compatibility check this page http://www.w3schools.com/cssref/sel_firstchild.asp

ps: if you want remove first dt and dd you must use this code :

div.exampleclass dl dt:first-child, div.exampleclass dl dd:first-child {
           display : none
       }
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.