- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个使用 HTML/CSS 设置的表格,它位于 UL 的 LI 元素内,该 UL 元素被转换为 Accordion 。问题是,当 LI 元素动画到特定高度时,它会改变表格单元格的高度,使最后一个单元格从 View 中隐藏。
如果从父 LI 元素中移除固定高度,则不存在此问题,但这是 Accordion 功能所必需的。有没有办法确保单元格始终具有相同的高度,而不管父容器的高度属性如何?
我已经设置了以下 JS Fiddle 来显示问题。默认情况下,它运行 Accordion 功能。如果你把它拿掉,你可以看到表格是在父容器中添加高度之前的样子。
由于 Accordion 默认关闭所有元素,您必须单击显示“表格”的标题栏才能打开表格并查看内容。
下面是给希望看到它的人的代码:
HTML:
<ul class="accordion">
<li>
<h3>Table</h3>
<span class="accordionContent">
<table>
<tr class="tableHeader">
<td class="first">HEADER</td>
<td>TITLE<span>SUBTITLE</span>
</td>
<td>TITLE<span>SUBTITLE</span>
</td>
<td class="last">TITLE<span>SUBTITLE</span>
</td>
</tr>
<tr class="tableRow_odd">
<td class="first">ACTIVE ITEM</td>
<td>ACTIVE ITEM</td>
<td>ACTIVE ITEM</td>
<td class="last">ACTIVE ITEM</td>
</tr>
<tr class="tableRow_even">
<td class="first"></td>
<td>ACTIVE ITEM</td>
<td>ACTIVE ITEM</td>
<td class="last"><span class="unavailable">INACTIVE ITEM</span>
</td>
</tr>
<tr class="tableRow_odd">
<td class="first"></td>
<td>ACTIVE ITEM</td>
<td><span class="unavailable">INACTIVE ITEM</span>
</td>
<td class="last"><span class="unavailable">INACTIVE ITEM</span>
</td>
</tr>
<tr class="tableRow_even">
<td class="first"></td>
<td>ACTIVE ITEM</td>
<td><span class="unavailable">INACTIVE ITEM</span>
</td>
<td class="last"><span class="unavailable">INACTIVE ITEM</span>
</td>
</tr>
<tr class="tableRow_odd">
<td class="first"></td>
<td>ACTIVE ITEM</td>
<td><span class="unavailable">INACTIVE ITEM</span>
</td>
<td class="last"><span class="unavailable">INACTIVE ITEM</span>
</td>
</tr>
</table> <span class="itemOverlay"></span></span>
</li>
</ul>
CSS:
body { padding: 15px }
/* Class Setups */
.accordion {
width: 500px;
margin: 0 auto;
overflow: hidden;
-webkit-border-radius: 5px;
-khtml-border-radius: 5px;
-moz-border-radius: 5px;
-o-border-radius: 5px;
border-radius: 5px;
}
.accordion li {
overflow: hidden;
position: relative;
}
.accordion li h3 {
color: #fff;
font-weight: 100;
padding: 7px 0 7px 12px;
border-bottom: 1px solid #4d82ae;
cursor: pointer;
font-size: 19px;
background: #5d8ebd;
/* Old browsers */
background: -moz-linear-gradient(top, #5d8ebd 0%, #659ecb 100%);
/* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, #5d8ebd), color-stop(100%, #659ecb));
/* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #5d8ebd 0%, #659ecb 100%);
/* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #5d8ebd 0%, #659ecb 100%);
/* Opera 11.10+ */
background: -ms-linear-gradient(top, #5d8ebd 0%, #659ecb 100%);
/* IE10+ */
background: linear-gradient(to bottom, #5d8ebd 0%, #659ecb 100%);
/* W3C */
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#5d8ebd', endColorstr='#659ecb', GradientType=0);
/* IE6-9 */
}
.accordionContent a {
display: block;
position: relative;
z-index: 999;
}
.accordionContent > * {
padding: 15px;
width: 100%;
height: 100%;
position: relative;
}
.accordionContent {
display: block;
width: 100%;
height: 100%;
padding: 0;
position: relative;
}
.accordionContent > table {
text-align: center;
padding: 0;
font-family:"Open Sans", sans-serif;
text-shadow: 0px 1px 0px #fff;
filter: dropshadow(color=#fff, offx=0, offy=1);
}
.accordionContent > table td {
vertical-align: middle;
border-right: 2px groove #eee;
font-size: 12px;
}
.accordionContent > table td {
padding: 10px 5px;
font-weight: 400;
}
.accordionContent .itemOverlay {
position: absolute;
left: 0;
bottom: 0;
width: 100%;
height: 100%;
background: transparent !important;
padding : 0;
-webkit-box-shadow: inset 0px 0px 10px 0px rgba(0, 0, 0, .45);
-khtml-box-shadow: inset 0px 0px 10px 0px rgba(0, 0, 0, .45);
-moz-box-shadow: inset 0px 0px 10px 0px rgba(0, 0, 0, .45);
-o-box-shadow: inset 0px 0px 10px 0px rgba(0, 0, 0, .45);
box-shadow: inset 0px 0px 10px 0px rgba(0, 0, 0, .45);
}
.accordionContent > table td span.unavailable {
font-weight: 200;
}
.accordionContent > table td.last {
border-right: none;
}
.accordionContent > table tr.tableRow_even {
background: #eee;
}
.accordionContent > table tr.tableHeader td {
background: #d2d2d2;
color: #282828;
height: 50px;
font-weight: bold;
font-size: 12px;
padding: 0;
}
.accordionContent > table tr.tableHeader td {
}
.accordionContent > table tr.tableHeader td span {
display: block;
font-size: 10px;
}
最佳答案
我不完全确定您要做什么,但您似乎希望更改表格中各个单元格的高度,我认为这是不可能的。您可以连续更改高度,但不能更改单个单元格。
为此,您可以使用列表、div 甚至其他混合了一些 JS 和 CSS 的 html 容器。
编辑,解决问题的答案:
删除“高度:100%;” from.accordionContent > *
当在 CSS 中使用百分比时,浏览器使用父级的高度而不是元素本身的高度(当然,如果我没记错的话),因此结合 overflow:hidden;这会使最后一排年久失修。
关于HTML/CSS - 高度固定的容器中表格单元格的高度不一致,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14391170/
我正在尝试实现 3 列固定-流体-固定布局。此外,布局的高度必须占据整个屏幕,使其看起来像从上到下的 3 个实心列。 总结: Left-column: fixed-width Center-col
我在网上搜索过,似乎找不到一个干净、简单、所有浏览器都友好的 3 列布局。 我希望有 3 列布局,左列固定为 200px,右列固定为 200px,中间列为剩余宽度,但最小宽度为 600px。所以整体最
关闭。这个问题需要更多focused .它目前不接受答案。 想改进这个问题吗? 更新问题,使其只关注一个问题 editing this post . 关闭 8 年前。 Improve this q
我正在使用一些音频指纹技术来标记长录音中的歌曲。例如,在广播节目中的记录。指纹机制工作正常,但我在归一化(或下采样)方面遇到问题。 在这里您可以看到两首相同的歌曲,但波形不同。我知道我应该进行一些直流
为什么使用cout调用setprecision和fixed以及其他iomanip函数不像例如name.find('')plz这样的字符串函数 最佳答案 它们允许您以以下方式链接操作: cout <<
我正在尝试创建一个侧边栏,当用户向下滚动页面时,该侧边栏会跟随用户,并且我设法使用以下代码实现了效果: 标记 Javas
我正在尝试设置一些性能分析以及影响缓冲策略的运行时决策。我的应用程序收到一个指向由库(CUDA 或 OpenCL)分配的缓冲区的指针。 如何测试内存区域是否被页面锁定? 据我所知,POSIX 给了我们
我正在用 C# 编写一个 B+ 树实现,我为我的应用程序选择的树实现有一个非常特定的结构,它是缓存敏感的。为了实现这些属性,它对树节点有严格的布局策略。 我想要的只是使用 C# 的 fixed 来表达
我试图通过将 fragment 注入(inject)容器来在每个屏幕的底部放置一个广告 View 。通过使用 LinearLayout,我可以将 adview 置于操作栏下方的顶部。我已经尝试了 Re
我正在尝试创建一个导航稍微复杂的网站。我已经让导航看起来像我想要的初始加载,但现在我试图让它粘性导航到滚动顶部。我已经能够在导航栏到达顶部时创建一个类,但无法使其粘滞。每次我添加一个位置时,它都会跳回
首先,我正在寻找一个纯 CSS 解决方案。我可以使用 JavaScript 非常轻松地做到这一点,所以不要费心给我提示如何在 JS 中做到这一点。 我有一个包含 3 个容器的网页。其中 2 个是固定的
我猜这里有一种 super 特例。 我正在处理许多包含。现在我正在一个包含的内容文件中编码。我需要一个灯箱,它有一个 20% 的黑色背景覆盖整个页面,包括本身固定的标题,并在先前的 PHP 文件中设置
我正在尝试制作一个包含两个“固定”侧边栏图像和一个“固定”标题图像的页面。由于标题是固定的(距顶部 0 到 10%)。我不希望页眉图像与页面上的任何文本重叠。我尝试将段落标记定位为“相对”,并将其设置
我遇到了一个(水平)居中固定位置元素的解决方案,如下所示: element { width: 200px; position: fixed; left: 0; righ
我试图让我的网站主体具有固定的高度(我想!)。 无论如何,站点正文只是白色,边框大小为 1。基本上,正文的大小取决于其中的内容,例如,随着添加更多内容,它会自动调整大小。 我想要的是垂直滚动条,这样主
是否可以在 css 中创建 master-detail-states 布局? 我需要 3 个占位符: +---------------+-------+ | A | B
我的问题是,我是否必须在每个 Get/Post 请求之前单独请求检查 SSL Pinning OkHttpClient client = new OkHttpClient.Builder().cert
假设我有一个具有 N 个节点的常量(一旦构建就不会改变)平衡树,每个内部节点都有 p 个子节点。显然,访问节点的最坏情况是 logp(N)。但是访问 r 个节点的摊销成本呢?如果我们按升序访问它们(有
我知道会话固定是用php破解网站的方法。 会话固定是一种允许攻击者劫持有效用户会话的攻击 session fixation 但我不知道这可以防止我的项目中出现此问题。 是描述解决方案的方式或样本。 最
我在 jquery 砖石布局内有一个导航元素,我想将其修复到特定位置,比如右上角。是否可以这样做,以便所有其他元素都位于它周围? 诸如前置导航之类的东西.. 这是我的代码:http://jsfiddl
我是一名优秀的程序员,十分优秀!