- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在为我公司的网站整理一张表格,比较不同类型的 AED 及其费用。我关注了this tutorial使其移动友好。原理是它使单元格像 div 一样堆叠在一起,同时使用 :before 插入与该数据关联的相应标题。
我看到的问题是,这不适用于多行标题;他们冲出牢房,撞上了那个(些): example image of the titles breaking out
右边的破折号是原始的td数据,左边的标题插入了:before {content: "";}
关于如何让单元格扩展有什么建议吗?我意识到这可能涉及采用一种全新的方法来使表格响应,所以我愿意改变。
完整代码:
<style>
table {
width: 100%;
border-collapse: collapse;
}
/* Zebra Striping */
tr:nth-of-type(even) {
background-color: #f0f0f0;
}
th {
background-color: #333;
color: white;
font-weight: bold;
}
td, th {
padding: 2px !important;
border: 1px solid #ccc;
text-align: center;
}
#aed-comparison img {
height: 60px;
}
thead, tbody, th, td, tr {
vertical-align: middle;
}
#zoll {
background-color: #ccffcc;
}
/* Hover roles */
tr:hover {
background-color: #e9e9e9;
}
#aed-images:hover {
background-color: white;
}
@media only screen and (max-width: 1048px) {
/* Alter the zebra striping */
tr:nth-of-type(even) {
background-color: inherit;
}
td:nth-of-type(even) {
background-color: #f0f0f0;
}
/* Alter hover roles */
tr:hover {
background-color: inherit;
}
td:hover {
background-color: #e6e6e6;
}
/* Force table to not behave like a table */
table, thead, tbody, th, td, tr {
display: block;
vertical-align: -50%;
}
/* Hide table headers (but not display: none;, for accessibility) */
thead tr {
position: absolute;
top: -9999px;
left: -9999px;
}
tr { border: 1px solid #ccc;}
td {
/* behave like a "row" */
border: none;
border-bottom: 1px solid #eee;
position: relative;
padding-left: 50% !important;
}
td:before {
/* Now like a table header */
position: absolute;
/* Top/left values mimic padding */
top: 2px;
left: 2px;
width: 45%;
padding-right: 10px;
}
table {
table-layout: fixed;
}
table td {
word-wrap:break-word;
}
/* Labeling the data */
td:nth-of-type(1):before {content: "ZOLL AED Plus";}
td:nth-of-type(2):before {content: "Cardiac Science Powerheart G5";}
td:nth-of-type(3):before {content: "Cardiac Science Powerheart G3";}
td:nth-of-type(4):before {content: "Philips HeartStart OnSite & Home";}
td:nth-of-type(5):before {content: "Defibtech View";}
td:nth-of-type(6):before {content: "Philips HeartStart FRx";}
td:nth-of-type(7):before {content: "Physio-Control LIFEPAK CR Plus & EXPRESS";}
td:nth-of-type(8):before {content: "HeartSine Samaritan PAD 350 & 450";}
td:nth-of-type(9):before {content: "Defibtech LIFELINE";}
}
</style>
<h2>The AED Plus Total Cost of ownership (TCO) Advantage for FIVE Years</h2>
<table id="aed-comparison">
<thead>
<tr> <!-- Titles -->
<th>Year*</th>
<th>ZOLL AED Plus</th>
<th>Cardiac Science Powerheart G5</th>
<th>Cardiac Science Powerheart G3</th>
<th>Philips HeartStart OnSite & Home</th>
<th>Defibtech View</th>
<th>Philips HeartStart FRx</th>
<th>Physio-Control LIFEPAK CR Plus & EXPRESS</th>
<th>HeartSine Samaritan PAD 350 & 450</th>
<th>Defibtech LIFELINE</th>
</tr>
</thead>
<tr id="aed-images"> <!-- Images -->
<th></th>
<td><img src="https://www.cpr-savers.com/assets/images/zollimage-crop.jpg" href="https://www.cpr-savers.com/ZOLL-AED-Plus_p_6646.html" /></td>
<td><img src="https://www.cpr-savers.com/assets/images/g5.jpg" href="https://www.cpr-savers.com/Cardiac-Science-Powerheart-G5-AED_p_10636.html" /></td>
<td><img src="https://www.cpr-savers.com/assets/images/g3-pro1-crop.jpg" href="https://www.cpr-savers.com/Cardiac-Science-Powerheart-G3-Plus-AED_p_6913.html" /></td>
<td><img src="https://www.cpr-savers.com/assets/images/prodimages/M5066A.jpg" href="https://www.cpr-savers.com/Philips-HeartStart-OnSite-AED_p_7687.html" /></td>
<td><img src="https://www.cpr-savers.com/assets/images/DCF-A2310EN-crop.jpg" href="https://www.cpr-savers.com/Defibtech-Lifeline-VIEW-AED_p_3893.html" /></td>
<td><img src="https://www.cpr-savers.com/assets/images/prodimages/861304_t.jpg" href="https://www.cpr-savers.com/Philips-HeartStart-FRx-AED--Re-Certified_p_10461.html" /></td>
<td><img src="https://www.cpr-savers.com/assets/images/80403-000149.jpg" href="https://www.cpr-savers.com/Physio-Control-LIFEPAK-CR-Plus-AED_p_4644.html" /></td>
<td><img src="https://www.cpr-savers.com/assets/images/350-bac-us-10_thumbnail.jpg" href="https://www.cpr-savers.com/HeartSine-Samaritan-PAD-450P-AED_p_10593.html" /></td>
<td><img src="https://www.cpr-savers.com/assets/images/prodimages/DCF-A100-EN_t.jpg" href="https://www.cpr-savers.com/Defibtech-Lifeline-AED_p_3890.html" /></td>
</tr>
<tr> <!-- YEAR 1 -->
<th>Year 1</th>
<td id="zoll">--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
</tr>
<tr> <!-- YEAR 2 -->
<th>Year 2</th>
<td id="zoll">--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>9V Battery: $7</td>
</tr>
<tr>
<th>Year 3</th>
<td id="zoll">--</td>
<td>Pads: $69</td>
<td>Pads: $46</td>
<td>Pads: $67</td>
<td>Pads: $59</td>
<td>Pads: $56</td>
<td>Pads & Charge Pack: $100</td>
<td>--</td>
<td>9V Battery: $7<br/>Pads: $38</td>
</tr>
<tr> <!-- YEAR 4 -->
<th>Year 4</th>
<td id="zoll">--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>--</td>
<td>Padpak (battery & pads): $175</td>
<td>9V Battery: $7</td>
</tr>
<tr> <!-- YEAR 5 -->
<th>Year 5</th>
<td id="zoll">--</td>
<td>Pads: $69<br />Battery: $395</td>
<td>Pads: $46<br />Battery: $395</td>
<td>Pads: $67<br />Battery: $169</td>
<td>Pads: $59<br />Battery: $169</td>
<td>Pads: $56<br />Battery: $167</td>
<td>Pads & Charge Pack: $100</td>
<td>--</td>
<td>9V Battery: $7<br />Pads: $38</td>
</tr>
<tr style="font-weight: bold;"> <!-- TOTAL COST -->
<th>Total Cost</th>
<td id="zoll">$0</td>
<td>$533</td>
<td>$487</td>
<td>$303</td>
<td>$287</td>
<td>$279</td>
<td>$200</td>
<td>$175</td>
<td>$104</td>
</tr>
<tr style="font-weight: bold;"> <!-- CHANGES REQUIRED -->
<th>Changes Required</th>
<td id="zoll">0</td>
<td>3</td>
<td>3</td>
<td>3</td>
<td>3</td>
<td>3</td>
<td>4</td>
<td>1</td>
<td>6</td>
</tr>
</table>
最佳答案
尝试替换以下 css:
table td {
word-wrap:break-word;
}
与:
table td {
word-wrap:break-word;
min-height: 60px;
}
这应该适合你。
关于html - :before content breaking out of table cell,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49265755/
这个问题在这里已经有了答案: What is the best way to parse html in C#? [closed] (15 个答案) 关闭 3 年前。 string input =
为什么 wrapper #4 没有继承其父表容器的高度?表格嵌套在一个显示 block 包装器中,每个嵌套的div是显示表格,每个表格继承到最里面的一个。是什么原因造成的,我该如何解决? jsfidd
我正在使用带有 Bootstrap 的自定义 css 作为外边框。但顶部边框不可见,除非我将其大小设置为 2 px。 我该如何解决这个问题? HTML #name 1.one 2.two 3.thr
我正在逻辑层面上设计一个数据库,以便稍后将其传递给程序员来交付。我只是粗略地了解它们的工作原理,所以我很难简洁地表达我的问题。这是我的问题: 我有一个名为 MEANINGS 的表。 我有一个名为 WO
在 Laravel 上,我们可以使用 DB::table('table')->get(); 或使用 model::('table')->all() 进行访问;我的问题是它们之间有什么区别? 谢谢。 最
我试图从以下内容中抓取 URL从 WorldOMeter 获取 CoVid 数据,在此页面上存在一个表,id 为:main_table_countries_today其中包含我希望收集的 15x225
这是我的图表数据库:/image/CGAwh.png 我用 SEQUELIZE 制作了我的数据库模型: 型号:级别 module.exports = (sequelize, DataTypes) =>
我真的不明白为什么我的代码不能按预期工作。当我将鼠标悬停在表格的每一行上时,我想显示一个图像(来 self 之前加载的 JSON)。每个图像根据行的不同而不同,我想将它们显示在表格之外的另一个元素中。
假设我的数据库中有一张地铁 map ,其中每条线路的每个站点都是一行。如果我想知道我的线路在哪里互连: mysql> SELECT LineA.stop_id FROM LineA, LineB WH
我最近经常使用这些属性,尤其是 display: table-cell。它在现代浏览器中得到了很好的支持,并且它对某些网格有很多好处,并且可以非常轻松地对齐内容,而无需棘手的标记。但在过去的几天里,我
在 CSS 中,我可以这样做: http://s1.ipicture.ru/uploads/20120612/Uk1Z8iZ1.png http://s1.ipicture.ru/uploads/20
问题作为标题,我正在学习sparkSQL,但我无法很好地理解它们之间的区别。谢谢。 最佳答案 spark.table之间没有区别& spark.read.table功能。 内部 spark.read.
我正在尝试根据 this answer 删除表上的非空约束.但是,它似乎没有在 sqlite_sequence 中创建条目。这样做之后,即使我可以在使用测试表时让它正常工作。 有趣的是,如果我备份我的
var otable = new sap.m.Table();//here table is created //here multiple header I'm trying to create t
下面两种方法有什么区别: 内存 性能 答: select table.id from table B: select a.id from table a 谢谢(抱歉,如果我的问题重复)。 最佳答案 完
我尝试在表格后添加点,方法是使用 table::after 选择器创建一个点元素并使用 margin: 5px auto 5px auto; 将其居中。它有效,但似乎在第一个表格列之后添加了点,而不是
我正在设计一个可以标记任何内容的数据库,我可能希望能够选择带有特定标记的所有内容。 我正在为以下两个选项而苦苦挣扎,希望得到一些建议。如果有更好的方法请告诉我。 选项A 多个“多对多”连接表。 tag
"center" div 中的下表元素导致 "left" div 中的内容从顶部偏移几个像素(在我的浏览器中为 8 ).在表格之前添加一些文本可消除此偏移量。 为什么?如何在不要求在我的表格前添加“虚
我是一名优秀的程序员,十分优秀!