zoukankan      html  css  js  c++  java
  • CSS常用操作-对齐

    index.html

    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>对齐</title>
         <link href="style8.css" type="text/css" rel="stylesheet">
    </head>
    <body>
         <div class="div">
             
         </div>
    </body>
    </html>

    利用margin属性

    css:

    *{
        margin:0px;
    }
    .div{
        70%;
        height:1000px;
        background-color: red;
        margin-left:auto;
        margin-right:auto;
    }

    利用position属性

    css:

     1 *{
     2     margin:0px;
     3 }
     4 .div{
     5     70%;
     6     height:1000px;
     7     background-color: red;
     8     position:absolute;
     9     right:0px;/*居右操作*/
    10 }

    利用float属性

    css

    *{
        margin:0px;
    }
    .div{
        70%;
        height:1000px;
        background-color: red;
        float:left;/*向左浮动,对齐*/
    }
  • 相关阅读:
    css3 省略号
    js一些常用方法
    nth-child使用
    常见表单元素处理
    表单的基本使用
    web基本概念
    PHP数组
    PHP函数
    PHP错误处理
    PHP文件载入
  • 原文地址:https://www.cnblogs.com/UniqueColor/p/5756536.html
Copyright © 2011-2022 走看看