zoukankan      html  css  js  c++  java
  • 盒子模型001基础

    当前div的宽度是 980px ,边框是 1px 那么这个div的总width是 982px

    如果div宽度固定为 980px,但是又加1px的边框,那么宽度就应该写 978px


    上右下左
    border 边框
    border-top 顶部边框
    border-right 右边框
    border-bottom 底边框
    border-left 左边框

    /*--边框属性 border border-style类型,border-color颜色,border-width粗细*/
    /*边框属性的简写 border:1px soild[实线] #fc0*/
    /*div{700px;height:200px;border:1px solid #A5CDEE;}*/
    /*盒子一定要定 width height text-align:水平对齐*/
    /*div{700px;height:200px;border:1px solid #A5CDEE;text-align:center;}*/
    /*盒子一定要定 width height text-align:文字水平居中对齐*/
    /*div{700px;height:200px;border:1px solid #A5CDEE;text-align:center;line-height:200px;}*/
    /*
    让盒子div居中 技巧操作:margin:0 auto;
    如果想让一个DIV(大盒子)在浏览器水平居中显示,就加以上属性margin:0 auto;
    */
    div{700px;height:200px;border:1px solid #A5CDEE;text-align:center;line-height:200px;margin:0 auto;}

    <style type="text/css">
    /*
    如果div的宽度是360px,高度是310px;边框是1px
    那么css里面应该写为width=360-左右的2=358px;
    height=310-上下的2=308px;
    */
    div{
    338px;height:288px;
    border:1px solid #ccc;/*将width和height都+2px*/
    padding-top:20px;/*将盒子高度+20px*/
    padding-left:20px;/*将盒子宽度+20px*/
    }
    </style>

    <style type="text/css">
    /*列表的样式 清掉 list-style:none;*/
    h2,ul,li{margin:0;padding:0;list-style:none;}
    .box{358px;height:308px;border:1px solid #ABBACA;}
    div h2{
    348px;height:40px;font-size:16px;background-color:#EEF2F6;
    line-height:40px;
    padding-left:10px;/*h2的宽度需要-10px;*/
    }
    /*因为 h2用了40px;所以 ul的height=308-40=268px;*/
    /*链接访问后004276 鼠标在上面是c00;*/
    /*ul{358px;height:268px;}*/
    ul{328px;height:238px;padding:15px;background-color:yellow;}
     
    ul li{height:28px;line-height:28px;}
    a:link,a:visited{font-size:14px;color:#004276,text-decoration:none;}
    a:hover{color:#c00;text-decoration:underline;}
    </style>

    <style type="text/css">

    /*他们之间的间距=30+40*/
    .left {background-color:yellow;margin-right:30px;}
    .right {background-color:blue;margin-left:40px;}
    div{300px;heigth:150px;border:1px solid red;background-color:yellow;}
    .top{margin-bottom:30px;}
    .bottom{margin-top:50px;}

    </style>

  • 相关阅读:
    C#使用WINDOW
    赵四小姐从十六岁开始跟张学良。跟一年,属奸情;跟三年,算偷情;跟六十年,便成为千古爱情!
    Microsoft Visual Studio 2010(VS2010)正式版 CDKEY / SN:
    C#中byte[]与string的转换
    sqlserver waitfor time '10:00' waitfor delay '1:00' 时间延时 和 间隔
    免费下载 精英讲解
    在决定使用ClickOnce发布你的软件前,应该知道的一些事情
    Windows7下注册OCX的注意事项
    用命令行以最快速简单的方式搭建MySQL数据库
    设计模式探索系列之Bridge模式
  • 原文地址:https://www.cnblogs.com/zjflove/p/2879796.html
Copyright © 2011-2022 走看看