javascript - Hide Html inside of a <td> not the <td> itself - Stack Overflow

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

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!

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744241007a4564705.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信