html css 表格自动高度,HTML/CSS - 具有固定高度的容器中表格单元格的高度不一致...
我有一個(gè)使用HTML/CSS設(shè)置的表格,它位于正在變成手風(fēng)琴的UL的LI元素中。問(wèn)題是,當(dāng)LI元素動(dòng)畫到特定高度時(shí),它會(huì)改變表格單元格的高度,使最后一個(gè)元素隱藏起來(lái)。HTML/CSS - 具有固定高度的容器中表格單元格的高度不一致
如果將固定高度從父LI元素中移除,但是這對(duì)手風(fēng)琴起作用是必需的,則此問(wèn)題不存在。有沒(méi)有辦法確保單元總是相同的高度,無(wú)論父容器高度屬性如何?
我已經(jīng)設(shè)置了下面的JS小提琴來(lái)顯示問(wèn)題。默認(rèn)情況下,它具有運(yùn)行的手風(fēng)琴功能。如果將其取下,則可以在將高度添加到父容器之前按照原樣查看表格。
由于手風(fēng)琴默認(rèn)為關(guān)閉所有元素,因此您必須點(diǎn)擊標(biāo)題欄上的“表”才能打開表格并查看內(nèi)容。
這里是為那些誰(shuí)希望看到它的代碼:
HTML:
Table
HEADER TITLESUBTITLE TITLESUBTITLE TITLESUBTITLE ACTIVE ITEM ACTIVE ITEM ACTIVE ITEM ACTIVE ITEM ACTIVE ITEM ACTIVE ITEM INACTIVE ITEM ACTIVE ITEM INACTIVE ITEM INACTIVE ITEM ACTIVE ITEM INACTIVE ITEM INACTIVE ITEM ACTIVE ITEM INACTIVE ITEM INACTIVE ITEM
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;
}
與50位技術(shù)專家面對(duì)面20年技術(shù)見證,附贈(zèng)技術(shù)全景圖總結(jié)
以上是生活随笔為你收集整理的html css 表格自动高度,HTML/CSS - 具有固定高度的容器中表格单元格的高度不一致...的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: html5 居中 字体 字号,css字体
- 下一篇: android镜像文件怎么命名,andr