-4

I have HTML like this:

<div class="meta-box-1">
<p> Content 1 </p>
<i> Content 2 </i>
<h4> Content 3 </h4>
</div>

Can I hide Content 2? How?

I googled for it and it seems it can not be done. But being new to every kind of coding I could not become sure. Any help would be appreciated.

t2m
  • 3
  • 2

2 Answers2

2

Adding div i { display: none; } will solve the issue described above.

JSFiddle

This will hide all i tags within div tags.

To hide all i tags within the specific div tag with the class meta-box-1, modify the CSS to:

.meta-box-1 i { display: none; }
applesElmi
  • 415
  • 5
  • 16
  • 1
    Thanks @applesElmi. Your answer is really helpful. Sorry I could not upvote you because of my insufficient reputation. It, in fact, is 1-4=-3. ;-) – t2m Jun 03 '16 at 15:05
0
div i {display:none;}

Adding this in your css file would hide all i tags that are stored within a div

Smithy
  • 771
  • 10
  • 29
  • Thanks @Smithy. Will this not hide all i tags within all the div elements? Shouldn't we use the class of the perticular div to hide only the i tag within it? – t2m Jun 03 '16 at 14:28
  • Yeah it would, if you add a class to the tag then simply just replace the i in the css with a dot (.) followed by the name of the class – Smithy Jun 03 '16 at 15:06