zoukankan      html  css  js  c++  java
  • table-layout:fixed 属性的解说

    table-layout:fixed 属性的解说
    如果想要一个table固定大小,里面的文字强制换行(尤其是在一长串英文文本,并且中间无空格分隔的情况下),以达到使过长的文字不撑破表格的目的,一般是使用样式:table-layout:fixed。但是在Firefox下面,会有一些问题:firefox下,内容会飘出框外,暂时没有找到解决办法

    例1:(IE浏览器)长串英文自动回行
    方法:同时加入word-wrap:break-word;

    table{table-layout:fixed;word-wrap:break-word;}

    例2:(IE浏览器)一个表格里的内容隐藏
    方法:使用样式table-layout:fixed与nowrap(一行一列)

    <style>
    .tbl {table-layout:fixed}
    </style>
    <table class="tbl" border=1 width=80>
    <tr>
    <td nowrap>abcdefghigklmnopqrstuvwxyz 1234567890</td>
    </tr>
    </table>
    效果:

     


    width=80起作用了,换行也被干掉了。
     

    例3:(IEFirefox浏览器)固定宽度使多余内容隐藏
    方法:在使用百分比固定td大小情况下使用样式table-layout:fixed与nowrap,并且使用div (一行两列)


    <style>
    .tbl {table-layout:fixed}
    .td {overflow:hidden;}
    </style>
    <table class="tbl" border=1 width=80>
    <tr>
    <td width=25% class="td" nowrap>
    <div>abcdefghigklmnopqrstuvwxyz 1234567890</div>
    </td>
    <td class="td" nowrap>
    <div>abcdefghigklmnopqrstuvwxyz 1234567890</div>
    </td>
    </tr>
    </table>

    效果:

     
     
  • 相关阅读:
    转 无障碍阅读 role aria-*
    (转)edm注意事项
    Spring IOC机制之使用注解配置bean
    Spring IOC机制使用SpEL
    使用Spring IOC容器引用外部属性文件
    如何将属性文件中的值保存到类中
    基于XML的类的属性的装配
    Java——事务
    Eclipse中使用Spring IOC容器的具体方法
    Java之批处理的实现
  • 原文地址:https://www.cnblogs.com/donchen/p/4110196.html
Copyright © 2011-2022 走看看