CSS_属性_hehe.employment.over.8.4

8.10 CSS_属性

  • 字体、文本:
    • font-size字体大小
    • color文本颜色
    • text-align对其方式
    • line-height行高
  • 背景:
    • background: 背景,可以是图片、颜色
  • 边框:
    • border设置边框,符合属性
  • 尺寸:
    • width宽度
    • height高度
  • 示例:
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>css属性</title>
    <style>
        p{
            /*字体*/
            color: #FF0000;
            font-size: 10px;
            text-align: center;
            line-height: 300px;
            /*
                border 边框
             */
            border: 1px solid red;
            /*p标签尺寸*/
            width:500px;
            height:600px;
            /*
               背景
            */
            background: url("img/logo.jpg") no-repeat center;

        }
    </style>
</head>
<body>
    <p>fdf</p>
</body>
</html>

8.11 CSS_属性_盒子模型

  • 盒子模型:控制布局
    • margin: 外边距 ,相对来说
    • padding: 内边距 ,相对来说
      • 默认情况下内边距会影响整个盒子的大小
      • box-sizing: border-box;: 设置盒子的属性,让width和height就是最终盒子的大小。
    • float: 浮动
      • left
      • right
  • note: 在这里插入图片描述
  • 示例:
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>css属性</title>


    <style>
        div{
            border: 1px solid red;
            width: 100px;
        }
        .div1{
            width: 100px;
            height: 100px;
            /*外边距*/
            /* margin: 50px; */
        }
        .div2{
            width: 200px;
            height: 200px;
            padding: 50px;
            /*
                设置盒子的属性,让width和height就是最终盒子的大小
             */
            box-sizing: border-box;
        }

        .div3{
            float: left;
        }

        .div4{
            float: left;
        }

        .div5{
            float: right;
        }

    </style>
</head>
<body>

    <div  class="div2">
        <div class="div1"></div>
    
    </div>
    
    <div class="div3">aaaa</div>
    <div class="div4">bbbbb</div>
    <div class="div5">cccc</div>
</body>
</html>
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值