table设计模式
来源:互联网 发布:软件开发成本控制 编辑:程序博客网 时间:2024/05/29 13:16
运用场景:
HTML:
<!DOCTYPE html><html><head> <style type="text/css"> div { width:300px; } table { table-layout:fixed; width:100%; height:50px; } td.col1 { width:20px; background-color:blue; } td.col2 { width:40px; background-color:red; } td.col3 { width:60px; background-color:yellow; } td.col3 { width:auto; background-color:yellow; } td { padding:5px; } </style></head><body> <div> <table cellpadding="0" cellspacing="0"> <tr> <td class="col1"></td> <td class="col2"></td> <td class="col3"></td> <td class="col4"></td> </tr> </table> </div><table><tr><td></td><td></td></tr></table></body></html>
chrome 效果
col1: 5px-10px-5px | col2: 5px-30px-5px ...
td中的width内含了padding的定义
IE & FF 效果
col1: 5px-20px-5px | col2: 5px-40px-5px ...
td中的width 与 padding不相干
问题描述:
写道
when applying table-layout:fixed to a table and using padding on the cells. IE and Firefox seem to work correctly by adding the cell width and the padding together. Chrome and Safari only use the cell width
解决方式:
<table style="table-layout: fixed;"> <tr> <td style="width: 100px;"> <div style="padding: 10px;"> lorem, ipsum. </div> </td> </tr></table>
即: 不给td定义padding , 而是在内容外又新增一个wrapper(容器),在wrapper中定义padding!
- table设计模式
- Checking Table 设计模式 - 从概念、建模、设计到实现
- table设计
- 2013-7-22-本周设计模式:Single-Record (Setup) Table
- Table Control设计
- HBase应用:Table设计
- table最佳设计
- HBase应用:Table设计
- HBase应用:Table设计
- HTML的 table 设计
- Checking Table 设计模式 - 从概念、建模、设计到实现——兼谈基于业务需求驱动的设计模式创新
- Hbase schema&table 设计实践
- html中table的设计
- Hbase数据模型与table设计
- 使用table表格设计调查表
- table表单边框样式设计
- 设计模式
- 设计模式
- Flex/Actionscript定时Timer实践运用
- HTML 5 form属性支持
- VS 2010 【LINK : fatal error LNK1123: 转换到 COFF 期间失败: 文件无效或损坏】
- 常用的js函数方法
- oracle学习笔记——1
- table设计模式
- css之margin collapse(外边距叠加)
- 编程语言学习之我见
- lite version是什么
- jquery图片点击自动翻页实现
- 对“低级”浏览器的额外处理
- A*
- 引用多个schema约束来创建xml文档
- 深入Linux网络核心堆栈--netfilter详解