zoukankan      html  css  js  c++  java
  • 【代码笔记】Web-CSS-CSS Align

    一,效果图。

     

    二,代码。

    复制代码
    <!DOCTYPE html>
    <html>
    
    <head>
        <meta charset="utf-8">
        <title>CSS Align</title>
        <style>
        body {
            margin: 0;
            padding: 0;
        }
        
        .container {
            position: relative;
            width: 100%;
        }
        
        .center {
            margin: auto;
            width: 70%;
            background-color: #b0e0e6;
        }
        
        .right {
            position: absolute;
            right: 0px;
            width: 300px;
            background-color: #b0e0e6;
        }
        
        .right {
            float: right;
            width: 300px;
            background-color: #b0e0e6;
        }
        </style>
    </head>
    
    <body>
        <div class="center">
            <p>In my younger and more vulnerable years my father gave me some advice that I've been turning over in my mind ever since.</p>
            <p>'Whenever you feel like criticizing anyone,' he told me, 'just remember that all the people in this world haven't had the advantages that you've had.'</p>
        </div>
        <p><b>Note: </b>Using margin:auto will not work in IE8, unless a !DOCTYPE is declared.</p>
        <div class="right">
            <p>In my younger and more vulnerable years my father gave me some advice that I've been turning over in my mind ever since.</p>
            <p>'Whenever you feel like criticizing anyone,' he told me, 'just remember that all the people in this world haven't had the advantages that you've had.'</p>
        </div>
        <div class="container">
            <div class="right">
                <p><b>Note: </b>When aligning using the position property, always include the !DOCTYPE declaration! If missing, it can produce strange results in IE browsers.</p>
            </div>
        </div>
        <div class="right">
            <p>In my younger and more vulnerable years my father gave me some advice that I've been turning over in my mind ever since.</p>
            <p>'Whenever you feel like criticizing anyone,' he told me, 'just remember that all the people in this world haven't had the advantages that you've had.'</p>
        </div>
    </body>
    
    </html>
    复制代码

     

    参考资料:《菜鸟教程》

     

  • 相关阅读:
    Linux/ visual studio 编译使用Poco
    无法安装 golang.org/x/tools/的库
    大牛blog汇总
    Redis整合Spring结合使用缓存实例
    js增加收藏
    iOS学习笔记12-网络(一)NSURLConnection
    Kick the ball!(dfs)湖南省赛第十届
    windows程序设计——飞机大战笔记(Access数据库的使用)
    DataGridView.DataSource= list(Of T)
    面试之SQL(1)--选出选课数量&gt;=2的学号
  • 原文地址:https://www.cnblogs.com/yang-guang-girl/p/10393767.html
Copyright © 2011-2022 走看看