zoukankan      html  css  js  c++  java
  • HTML4

    格式布局

    三种排版方式:fixed; absolute; relative

    position:fixed  锁定位置,相对于浏览器的位置进行定位(即固定定位不会随着下拉菜单而移动,如有些网站的右下角弹窗)

    position: absolute  绝对定位,绝对位置进行定位,定位后相当于该位置处于漂浮状态即此位置类似消失

    position:relative   相对于之前位置进行定位,但是定位后图形移动到新位置但是它原来的位置没有改变还在原来位置占用着。

    三种排版比较的简单的例子:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>无标题文档</title>
    </head>
    <style>
    .a1
    { 1000px; height:200px; top:0px; left:0px; border:3px solid #F00; }
    .a2
    { 100px; height:100px; top:0px; left:0px; border:3px solid #F00; }
    .a3
    { 100px; height:100px; top:0px; left:0px; border:3px solid #F00;}
    .a4
    { 100px; height:100px; top:0px; left:200px; border:3px solid #F00; position:relative; }
    .a5
    { 100px; height:100px; top:0px; left:200px; border:3px solid #F00; position:relative;}
    .a6
    { 100px; height:100px; top:0px; left:0px; border:3px solid #F00; position:absolute; }
    .a7
    { 100px; height:100px; top:0px; left:0px; border:3px solid #F00; }
    </style>
    <body>
    <div class="a1">a</div>
    <div class="a2">b</div>
    <div class="a3">c</div>
    <div class="a4">d</div>
    <div class="a5">e</div>
    <div class="a6">f</div>
    <div class="a7">g</div>
    </body>
    </html>
    

    汽车之家格式布局简单应用:

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>汽车之家</title>
    </head>
    <style>
    .a1
    { 100%; height:30px; background-color:#333; border:1px solid black; position:relative;}
    .a2
    { 100%; height:35px; background-color:#006; border:1px solid black; position:relative;}
    .a3
    { 100%; height:45px; background-color:#CCC; border:1px solid black; position:relative;}
    .a4
    { 50%; height:100px; left:12%; top:10px; border:1px solid black; position:relative}
    .a5
    { 24%; height:100px; left:63%; top:-92px; border:1px solid black; position:relative}
    .a6
    { 75%; height:50px; left:12%; top:-82px; border:1px solid black; position:relative}
    .a7
    { 75%; height:30px; left:12%; top:-65px; border:1px solid black; position:relative}
    .a8
    { 75%; height:200px; left:12%; top:-65px; border:1px solid black; position:relative}
    .a9
    { 75%; height:60px; left:12%; top:-60px; border:1px solid black; position:relative}
    .a10
    { 25%; height:250px; left:12%; top:-40px; border:1px solid black; position:relative}
    .a11
    { 30%; height:1600px; left:39%; top:-292px; border:1px solid black; position:relative}
    .a12
    { 16%; height:200px; left:71%; top:-1892px; border:1px solid black; position:relative}
    .a13
    { 25%; height:100px; left:12%; top:-1835px; border:1px solid black; position:relative}
    .a14
    { 25%; height:100px; left:12%; top:-1825px; border:1px solid black; position:relative}
    .a15
    { 25%; height:700px; left:12%; top:-1815px; border:1px solid black; position:relative}
    .a16
    { 25%; height:80px; left:12%; top:-1805px; border:1px solid black; position:relative}
    .a17
    { 25%; height:150px; left:12%; top:-1795px; border:1px solid black; position:relative}
    .a18
    { 25%; height:150px; left:12%; top:-1785px; border:1px solid black; position:relative}
    .a19
    { 16%; height:1380px; left:71%; top:-3170px; border:1px solid black; position:relative}

    .a20
    { 8%; height:400px; left:4%; top:150px; border:1px solid red; position:fixed}
    .a21
    { 8%; height:400px; left:87%; top:150px; border:1px solid red; position:fixed}

    </style>
    <body>
    <div class="a1">1</div>
    <div class="a2">2</div>
    <div class="a3">3</div>
    <div class="a4">4</div>
    <div class="a5">5</div>
    <div class="a6">6</div>
    <div class="a7">7</div>
    <div class="a8">8</div>
    <div class="a9">9</div>
    <div class="a10">10</div>
    <div class="a11">11</div>
    <div class="a12">12</div>
    <div class="a13">13</div>
    <div class="a14">14</div>
    <div class="a15">15</div>
    <div class="a16">16</div>
    <div class="a17">17</div>
    <div class="a18">18</div>
    <div class="a19">19</div>
    <div class="a20">20</div>
    <div class="a21">21</div>

    </body>
    </html>

  • 相关阅读:
    python3操作mysql数据库表01(封装查询单条、多条数据)
    python3操作mysql数据库表01(基本操作)
    Python3基础02(列表和字符串处理)
    Python3+Selenium3+webdriver学习笔记14(等待判断 鼠标事件 )
    Python3+Selenium3+webdriver学习笔记13(js操作应用:弹出框无效如何处理)
    Python3+Selenium3+webdriver学习笔记12(js操作应用:滚动条 日历 内嵌div)
    Python3+Selenium3+webdriver学习笔记11(cookie处理)
    Python3+Selenium3+webdriver学习笔记10(元素属性、页面源码)
    Python3+Selenium3+webdriver学习笔记9(发送富文本信息及上传文件处理)
    Python3+Selenium3+webdriver学习笔记8(单选、复选框、弹窗处理)
  • 原文地址:https://www.cnblogs.com/zhangnaitao/p/5797076.html
Copyright © 2011-2022 走看看