css疑难

2017-03-03  本文已影响19人  神刀

css疑难

table
跨行 colspan=“3“
跨列 rowspan
标题 <caption align="top">我是表格标题</caption>
display:table-header-group 指定为表格标题
display:table-row-group

文本
单词换行
word-wrap:break-word // 单词换行
word-break: break-all // 单词内换行

css ****奇技淫巧
user-select:none; 禁止页面元素选中


list-item
  [1]不设置宽度时,宽度撑满一行
  [2]独占一行
  [3]支持宽高

run-in
  run-in是一个有意思的块/行内元素混合,可以使某些块级元素成为下一个元素的行内部分。如果一个元素生成run-in框,而且该框后面是一个块级框,那么该run-in元素将成为块级框开始处的一个行内框,run-in框格式化成另一个元素中的行内框,但它们仍从文档中的父元素继承属性
  [注意]只有safari和IE8+支持
<h3 style="display:run-in">run-in test</h3>
<p>paragraph</p>

若run-in框后面不是块级框时,run-in框本身将成为块级框
<span style="display:run-in">run-in test</span>
<span>paragraph</span>

表格类元素

table{display: table;}
thead{display: table-header-group;}
tbody{display: table-row-group;}
tfoot{display: table-footer-group;}
tr{display: table-row;}
td,th{display: table-cell;}
col{display: table-column;}
colgroup{display: table-column-group;}
caption{display: table-caption;}

table
【特征】
  [1]不设置宽度时,宽度由内容撑开
  [2]独占一行
  [3]支持宽高
  [4]默认具有表格特征,可设置table-layout、border-collapse、border-spacing等表格专有属性

inline-table
【特征】
  [1]不设置宽度时,宽度由内容撑开
  [2]非独占一行
  [3]支持宽高
  [4]默认具有表格特征,可设置table-layout、border-collapse、border-spacing等表格专有属性

table-cell
【特征】
  [1]不设置宽度时,宽度由内容撑开
  [2]非独占一行
  [3]支持宽高
  [4]垂直对齐
  [5]同级等高

table-caption
【特征】
  [1]不设置宽度时,宽度由内容撑开
  [2]独占一行
  [3]支持宽高

注意事项
【1】如果一个元素是绝对定位元素,float的值设置为none,对于浮动元素或绝对定位元素,计算值由声明值确定

【2】对于根元素,如果声明为值inline-table或table,都会得到计算值table,声明为none时则会得到同样的计算值none,所有其他display值都计算为block
好的

上一篇 下一篇

猜你喜欢

热点阅读