为什么可见=“假”?不适用于纯 html 表?
html table的visible属性不起作用。
如果该财产有缺陷,他们为什么还要拥有该财产?我必须使用 style="visibility:hidden"
才能隐藏表格。
请解释原因。我很好奇
这是我正在使用的代码。目的是隐藏整个表格,但不隐藏表格或其中的控件
<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>
The visible property of html table does not work.
Why do they have that property if its defective? I had to use style="visibility:hidden"
in order to hide a table.
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>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
使用
display: none
代替。此外,这可能正是您所需要的,因为这还会通过删除表格占用的空间来截断页面,而visibility:hidden
会留下表格留下的空白。Use
display: none
instead. Besides, this is probably what you need, because this also truncates the page by removing the space the table occupies, whereasvisibility: hidden
leaves the white space left by the table.您可能正在寻找
style="display:none;"
它将完全隐藏您的元素,而可见性隐藏它但保留屏幕位置...更新:
visible< /code> 不是 HTML 中的有效属性,这就是它不起作用的原因...请参阅上面我的建议以正确隐藏您的 html 元素
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...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如果您想使用它,请对该表使用
runat="server"
。之后在服务器端代码中使用tablename.visible=False
。If you want use it, use
runat="server"
for that table. After that usetablename.visible=False
in server side code.对于很久以前的类似帖子,隐藏表格可见性似乎存在问题。
您有两种选择,一种是使用
display:none
属性。或者两个将表格包装在 div 中并使 div 隐藏。
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.Or two wrap the table in a div and make the div hidden.
visibility:hidden 是正确的语法,但“隐藏”表的另一种方法是使用 display:none 或动态使用 JQuery:
visibility:hidden is the proper syntax, but another way to 'hide' the table is with display:none or dynamically with JQuery:
对于最佳实践 - 使用
style="display:"
它将在任何地方工作..
For the best practice - use
style="display:"
it will work every where..
“他们”是谁?我认为
html
中没有visible
属性。Who "they"? I don't think there's a
visible
attribute inhtml
.visible="false" 不起作用的原因是 HTML 被一个财团定义为标准。 Table 元素的标准没有定义可见性属性。
您可以通过访问 标准来查看表的所有有效属性表格的网页。
该页面可能有点难以阅读,因此这里是另一个页面的链接,该页面使其更易于阅读。
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.
You can see all the valid properties for a table by going to the standards web page for tables.
That page can be a bit hard to read, so here is a link to another page that makes it easier to read.