Html 为什么visible="false" 不适用于普通的html 表?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8344294/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Why is visible="false" not working for a plain html table?
提问by Enggr
The visible property of html table does not work.
html 表的可见属性不起作用。
Why do they have that property if its defective? I had to use style="visibility:hidden"
in order to hide a table.
如果它有缺陷,他们为什么拥有该财产?我不得不使用style="visibility:hidden"
以隐藏表格。
Please explain why. I am very curious
请解释原因。我很好奇
Here's the code I'm using. The intention is to hide the table as a whole but its not hiding the table or the controls inside it
这是我正在使用的代码。目的是隐藏整个表格,但不隐藏表格或其中的控件
<table visible="false">
<tr>
<td >
<label>Pick the color for action needed and paste it on textbox</label>
</td>
<td>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
</td>
<td>
<asp:Button ID="Button1" runat="server" Text="Apply color" />
</td>
</tr>
</table>
回答by Chris C
Use display: none
instead. Besides, this is probably what you need, because this also truncates the page by removing the space the table occupies, whereas visibility: hidden
leaves the white space left by the table.
使用display: none
来代替。此外,这可能是您所需要的,因为这也会通过删除表格占用的空间来截断页面,而visibility: hidden
留下表格留下的空白空间。
回答by Leon
You probably are looking for style="display:none;"
which will totally hide your element, whereas the visibility hides it but keeps the screen place it would take...
您可能正在寻找style="display:none;"
哪个将完全隐藏您的元素,而可见性隐藏它但保持屏幕位置......
UPDATE: visible
is not a valid property in HTML, that's why it didn't work... See my suggestion above to correctly hide your html element
更新:visible
在 HTML 中不是有效属性,这就是它不起作用的原因...请参阅上面我的建议以正确隐藏您的 html 元素
回答by san797
If you want use it, use runat="server"
for that table. After that use tablename.visible=False
in server side code.
如果要使用它,请runat="server"
用于该表。之后tablename.visible=False
在服务器端代码中使用。
回答by Pastor Bones
visibility:hidden is the proper syntax, but another way to 'hide' the table is with display:none or dynamically with JQuery:
可见性:隐藏是正确的语法,但另一种“隐藏”表格的方法是使用 display:none 或使用 JQuery 动态:
$('#myTable').hide()
回答by Matt Seymour
For a similar post a long time ago there seems to be issues with making table visibility hidden.
对于很久以前的类似帖子,隐藏表格可见性似乎存在问题。
You have two options, one is to use the display:none
attribute.
您有两种选择,一种是使用display:none
属性。
Or two wrap the table in a div and make the div hidden.
或者两个将表格包裹在一个 div 中并使 div 隐藏。
<div id="wrapper" style="visibility:hidden">
<table>
<tr>
<td>
Content
</td>
</tr>
</table>
</div>
回答by pedram
For the best practice - use style="display:"
对于最佳实践 - 使用 style="display:"
it will work every where..
它会在任何地方工作..
回答by M Akin
The reason that visible="false" does not work is because HTML is defined as a standard by a consortium group. The standard for the Table element does not have a visibility property defined.
visible="false" 不起作用的原因是因为 HTML 被一个财团定义为标准。Table 元素的标准没有定义可见性属性。
You can see all the valid properties for a table by going to the standards web pagefor tables.
您可以通过转到表格的标准网页来查看表格的所有有效属性。
That page can be a bit hard to read, so hereis a link to another page that makes it easier to read.
该页面可能有点难以阅读,因此这里有一个指向另一个页面的链接,以便于阅读。
回答by Michael Krelin - hacker
Who "they"? I don't think there's a visible
attribute in html
.
谁是“他们”?我不认为有一个visible
在属性html
。