Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Hide only text in html paragraph

Tags:

html

css

I want to hide text in paragraph, but there are one image and some text on it. When I'm using css to display none so all paragraph are hidden...but I want to only hide the text not image. Here is the code.

<p>
  <a href="/_blog/News_and_Inspiration/post/Cooking_up_a_storm/"><img alt="" style="border: 0px solid; width: 100px; height: 150px; float: left; margin-right: 10px; margin-bottom: 10px;" src="/images/blog/Shaun-Clouston.jpg" /></a>
    The executive chef of Wellington&rsquo;s award winning  Restaurant, Shaun Clouston is just one of the award winning New Zealand Beef and Lamb Ambassador chefs we have cooking up a storm at our Rural Women New Zealand Beef + Lamb Cooking Demonstrations over the coming months.&nbsp;
</p>

<p>
  <img src="/images/blog/Southland Life Education Trust Car 2.jpg" alt="">
  Two years ago the Southland Life Education Community Trust approached our four Southland Provincials, asking for assistance to replace their educator’s car, as the current one needed major repairs.
</p>
like image 221
asif Avatar asked Jul 04 '12 08:07

asif


People also ask

How do I hide paragraph text in HTML?

visibility:hidden , color:transparent and text-indent will do this.

How do I hide text in an element?

If the point is simply to make the text inside the element invisible, set the color attribute to have 0 opacity using a rgba value such as color:rgba(0,0,0,0); clean and simple. Save this answer.

How do I hide text in a span?

The hidden attribute hides the <span> element. You can specify either 'hidden' (without value) or 'hidden="hidden"'. Both are valid. A hidden <span> element is not visible, but it maintains its position on the page.


1 Answers

Try:

p {
    font-size: 0;
}

And specify the font-size for any descendent elements you want visible.

like image 101
David Thomas Avatar answered Sep 28 '22 10:09

David Thomas