【发布时间】:2014-09-13 21:46:34
【问题描述】:
我正在尝试使用 css-tables 和纯 JavaScript(无 jQuery)隐藏和显示表格行。
我有一个div,其中display 设置为table-row,其中一个nav。不管我做什么,border-collapse 等等,div 仍然保持了它的一些高度。
有什么想法吗?
HTML:
<!-- Header -->
<header id='header'> <!-- Table Row 1 -->
<div id="header-table">
<div id='back'>
<button id='back-button'>←</button>
</div>
<div id="title">
<h1 id='title-h1'>Title</h1>
</div>
<div id="menu">
<button id='menu-button'>≡</button>
</div>
</div>
</header>
<nav id="menu-nav">
<a href="#intro">Introductory Page</a>
<a href="#list">Activity List</a>
<a href="#settings">Settings</a>
<a href="#about">About</a>
</nav>
<div id="body"> <!-- Table Row 3 -->
<div id="wrapper">
CSS
header#header {
position: relative;
display: table-row;
}
div#menu-nav-cell {
position: relative;
display: table-row;
text-align: center;
overflow: hidden;
background: yellow;
}
nav#menu-nav {
display: table-row;
height: 0em;
width: 100%;
color: #000;
background: pink;
}
div#body {
position: relative;
display: table-row;
height: 100%;
}
div#wrapper {
position: relative;
height: 100%;
}
【问题讨论】:
-
你能给我们举个例子吗?