美文网首页
table布局

table布局

作者: 丶灰太狼他叔 | 来源:发表于2018-03-11 22:14 被阅读7次

关于table布局的问题,首先height必须要给一个固定的px值,然后就是td一个总的colspan值,下面td设置colspan的值来设置宽度。不过这一行总的colspan的值加起来等于td的colspan的值。
一个例子:

<!DOCTYPE html>  
<html>  
<head lang="en">  
    <meta charset="UTF-8">  
    <title>table布局</title> 
    <style type="text/css">
        td {
            text-align: center;
        }
    </style>
</head>  
<body marginwidth="0px" marginheight="0px">  
    <table width="700px" height="650px" style="background-color: aqua">  
        <tr>  
            <td colspan="10" width="100%" height="20%" style="background-color: chartreuse">这是头部</td>  
        </tr>  
        <tr>  
            <td colspan="2" width="20%" height="40%" style="background-color: antiquewhite">左菜单</td>  
            <td colspan="3"  width="30%" height="40%" style="background-color: coral">左内容</td>  
            <td colspan="2"  width="20%" height="40%" style="background-color: cornflowerblue">右菜单</td>  
            <td colspan="3"  width="30%" height="40%" style="background-color: coral">右内容</td>  
        </tr>  
        <tr>  
            <td width="20%"  height="10%" style="background-color: crimson">公司地址:</td> 
            <td width="80%" colspan="9"  height="20%" style="background-color: crimson">上海市</td>   
        </tr>  
        <tr>  
                <td colspan="2"  height="10%" style="background-color: crimson">公司地址:</td> 
                <td  colspan="3"  height="20%" style="background-color: crimson">上海市</td> 
                <td  colspan="2"  height="20%" style="background-color: crimson">上海市</td>
                <td  colspan="3"  height="20%" style="background-color: crimson">上海市</td>  
            </tr>  
        <tr>  
            <td colspan="10" height="20%" style="background-color: crimson">这是底部</td>  
        </tr>  
    </table>  
</body>  
</html> 

效果图:


table.png

相关文章

  • HTML表格、表单

    表格 table常用标签 table常用属性: 传统布局: 传统的布局方式就是使用table来做整体页面的布局,布...

  • CSS

    首先来聊聊传统的 table 布局吧。传统的 table 布局就是利用 table 元素所有的零边框特性来进行布局...

  • 未知宽高元素的水平垂直居中

    4种实现思路 table布局(display:table) 绝对布局(position:absolute)+tra...

  • 前端日记

    #水平垂直居中布局: flex弹性布局,table-cell布局(父级table),定位(多种方式); #如何安...

  • 自学H5Day4

    一、div布局 二、table布局

  • HTML布局

    使用div布局 使用table布局

  • Web前端基础(二):HTML5与网页入门

    1. 网站布局 DIV用于布局,Table用于显示数据,这是现在最基本的设计原则。 1.1 Table 布局...

  • css常用布局总结

    一、左右布局 1.table:table的li实现 实现原理: table标签是能够具有实现左右布局的属性,也是我...

  • 多列等高布局

    flex布局 table

  • 菜鸟学习笔记:表格布局和div+css布局

    网页布局可以通过表格和div元素来实现(注:table布局已经淘汰),首先我们来看看table布局 实现效果 **...

网友评论

      本文标题:table布局

      本文链接:https://www.haomeiwen.com/subject/tutgfftx.html