admin管理员组

文章数量:1399978

This has to be a crazy basic question, but for the life of me I can't figure it out right now...

I have a <td class="hide">Some text</td>

I want only the TEXT/HTML inside of the <td> to be hidden, NOT the entire <td> itself. How can this be achieved with CSS??

jsFiddle Example

*Note

Applying a span inside it, etc isn't necessarily an option.

This has to be a crazy basic question, but for the life of me I can't figure it out right now...

I have a <td class="hide">Some text</td>

I want only the TEXT/HTML inside of the <td> to be hidden, NOT the entire <td> itself. How can this be achieved with CSS??

jsFiddle Example

*Note

Applying a span inside it, etc isn't necessarily an option.

Share Improve this question asked Jan 29, 2014 at 17:03 Mark Pieszak - Trilon.ioMark Pieszak - Trilon.io 67.3k15 gold badges83 silver badges96 bronze badges 1
  • 1 You can't do that if you don't want to wrap the text inside the td in a container... – damian Commented Jan 29, 2014 at 17:04
Add a ment  | 

3 Answers 3

Reset to default 8

Instead of

display: none;

You could try

text-indent: -9999px;

What about just making it transparent?

opacity: 0.0;

You can either do:

$('.hide').css('color','rgba(0,0,0,0)');//will make the text transparent and retain the width

or

$('.hide').text('');//will delete the text, not retaining the width

or:

$('.hide').wrap('<span style="opacity:0">');//will use a span and retain the width 

JSFiddle

Hope this helps!

本文标签: javascriptHide Html inside of a lttdgt not the lttdgt itselfStack Overflow