html不占空间隐藏,如何隐藏HTML表行

Can you include some code? I add style="display:none;" to my table rows all the time and it effectively hides the entire row.

You can set

and then show it back with JavaScript:

var result_style = document.getElementById('result_tr').style;

result_style.display = 'table-row';

I would really like to see your TABLE's styling. E.g. "border-collapse"

Just a guess, but it might affect how 'hidden' rows are being rendered.

If display: none; doesn't work, how about setting height: 0; instead? In conjunction with a negative margin (equal to, or greater than, the height of the top and bottom borders, if any) to further remove the element? I don't imagine that position: absolute; top: 0; left: -4000px; would work, but it might be worth a try.

For my part, using display: none works fine.

Thought I'd add to this a potential other solution:

stuff

I've only tested it on Chrome but putting this on the

hides the row PLUS all the cells inside the row still contribute to the widths of the columns. I will sometimes make an extra row at the bottom of a table with just some spacers that make it so certain columns can't be less than a certain width, then hide the row using this method. (I know you're supposed to be able to do this with other css but I've never gotten that to work)

Again, I'm in a purely chrome environment so I have no idea how this functions in other browsers.

Add some of the following line-height:0px;font-size:0px;height:0px;margin:0;padding:0;

I forget which one does it. I think it's line-height for IE6.

I was having the same issue, I even added style="display: none" to each cell.

In the end I used HTML comments

You can use style display:none with tr to hide and it will work with all browsers.

This happened to me and I was baffled as to why. Then I noticed that if i removed any nbsp; i had within the rows, then the rows didn't take up any space.

var result_style = document.getElementById('result_tr').style;

result_style.display = '';

is working perfectly for me..

You need to put the change the input type to hidden, all the functions of it work but it is not visible on the page

as long as the input type is set to that you can change the rest.

Good Luck!!

HTML:

poi.attraction

JavaScript:

function updateMap() {

map.setOptions({'styles': getStyles() });

}

function getStyles() {

var styles = [];

for (var i=0; i < types.length; i++) {

var style = {};

var type = types[i];

var enabled = document.getElementById(type).checked;

style['featureType'] = 'poi.' + type;

style['elementType'] = 'labels';

style['stylers'] = [{'visibility' : (enabled ? 'on' : 'off') }];

styles.push(style);

}

return styles;

}

I was having same problem and I resolved the issue.

Earlier css was overflow:hidden; z-index:999999;

I change it to overflow:visible;

position: absolute will remove it from the layout flow and should solve your problem - the element will remain in the DOM but won't affect others.

You can set

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值