Home > Web Front-end > H5 Tutorial > body text

H5 learning journey-H5 layout (10)

黄舟
Release: 2017-02-17 14:35:58
Original
1292 people have browsed it

Two implementation methods: p and table

p way to implement layout

Code example

<!DOCTYPE html><html lang="en"><head>
    <meta charset="UTF-8">
    <title>H5布局0</title>
    <style type="text/css">
        body{            margin: 0px;;
        }
        #container{            width:100%;            height: 950px;            background-color: chartreuse;        }
        #heading{            width: 100%;            height: 10%;            background-color: brown;        }
        #content_menu{            width:30%;            height: 80%;            background-color: blue;            float: left;        }
        #content_body{            width: 70%;            height: 80%;            background-color: darkgreen;            float: left;        }
        #footer{            width: 100%;            height: 10%;            background-color: aliceblue;            clear: both;        }

    </style></head><body>
    <p id="container">
        <p id="heading">头部</p>
        <p id="content_menu">内容菜单</p>
        <p id="content_body">内容主体</p>
        <p id="footer">尾部</p>
    </p></body></html>
Copy after login
Copy after login

! ! ! ! ! ! ! float means floating from left to right clear means clearing

Rendering

H5 learning journey-H5 layout (10)

##table layout

Code example

<!DOCTYPE html><html lang="en"><head>
    <meta charset="UTF-8">
    <title>H5布局0</title></head><body>
    <table width="100%" height="950px" style="background-color: chartreuse">
        <tr>
            <td width="100%" height="10%" style="background-color: brown" colspan="3">头部</td>
        </tr>
        <tr>
            <td width="20%" height="80%" style="background-color: aqua">左菜单</td>
            <td width="60%" height="80%" style="background-color: black">主体</td>
            <td width="200%" height="80%" style="background-color:crimson">右菜单</td>
        </tr>
        <tr>
           <td width="100%" height="10%" style="background-color: deeppink" colspan="3">尾部</td>
        </tr>

    </table></body></html>
Copy after login
Copy after login

! ! ! ! Pay attention to the colspan attribute

Rendering

H5 learning journey-H5 layout (10)

Two implementation methods: p and table

p method of implementing layout

Code example

<!DOCTYPE html><html lang="en"><head>
    <meta charset="UTF-8">
    <title>H5布局0</title>
    <style type="text/css">
        body{            margin: 0px;;
        }
        #container{            width:100%;            height: 950px;            background-color: chartreuse;        }
        #heading{            width: 100%;            height: 10%;            background-color: brown;        }
        #content_menu{            width:30%;            height: 80%;            background-color: blue;            float: left;        }
        #content_body{            width: 70%;            height: 80%;            background-color: darkgreen;            float: left;        }
        #footer{            width: 100%;            height: 10%;            background-color: aliceblue;            clear: both;        }

    </style></head><body>
    <p id="container">
        <p id="heading">头部</p>
        <p id="content_menu">内容菜单</p>
        <p id="content_body">内容主体</p>
        <p id="footer">尾部</p>
    </p></body></html>
Copy after login
Copy after login

! ! ! ! ! ! ! float means floating from left to right clear means clearing

Rendering

H5 learning journey-H5 layout (10)

table layout

Code example

<!DOCTYPE html><html lang="en"><head>
    <meta charset="UTF-8">
    <title>H5布局0</title></head><body>
    <table width="100%" height="950px" style="background-color: chartreuse">
        <tr>
            <td width="100%" height="10%" style="background-color: brown" colspan="3">头部</td>
        </tr>
        <tr>
            <td width="20%" height="80%" style="background-color: aqua">左菜单</td>
            <td width="60%" height="80%" style="background-color: black">主体</td>
            <td width="200%" height="80%" style="background-color:crimson">右菜单</td>
        </tr>
        <tr>
           <td width="100%" height="10%" style="background-color: deeppink" colspan="3">尾部</td>
        </tr>

    </table></body></html>
Copy after login
Copy after login
! ! ! ! Pay attention to the colspan attribute

Rendering

H5 learning journey-H5 layout (10)

The above is the content of the H5 learning journey-H5 layout (10). For more related content, please pay attention to PHP Chinese Net (www.php.cn)!



Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!