CSS之文本、列表、背景、浮动

一、文本属性

1.大小,字体,加粗,倾斜,水平对齐

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
       p{color: brown;
        font-style: oblique;
        font-size: 20px;
        } 
       .h{
           text-align: center;
           font-size: 47px;
           font-family: "宋体";
           font-weight: 800;
           font-style: italic;
       }
    </style>
</head>
<body>
    <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. <br> neque architecto in voluptate ratione facilis eos rem veritatis ipsum explicabo assumenda beatae accusantium unde nulla minus consequatur,<br> repellat quo quibusdam?</p>
    <div class="h">好好好好好好</div>
</body>
</html>

 2.行高,首行缩进,字间距,文本修饰,检索大小写,简写方式

 <style>
        p{color: brown;
        font-style: oblique;
        font-size: 20px;
        /* "2em"缩进两个字符 */
        text-indent: 2em;
        /* 字符间距 */
        letter-spacing: 0;
        /* 下划线,删除线,上划线 */
        text-decoration: underline;
        /* 转换大小写 */
        text-transform: uppercase;
        }  

        /*font简写方式,顺序不能变 */
        p{
            color: rgb(23, 116, 163);
            font: italic bold  20px 楷体
        }
        .h{
           height: 20px;
           background-color: antiquewhite;
           text-align: left;
           font-weight: 800;
           font-style: italic;
           line-height: 10px;
       }
    </style>
</head>
<body>
    <p>Lorem ipsum dolor sit amet consectetur adipisicing elit. <br> neque architecto in voluptate ratione facilis eos rem veritatis ipsum explicabo assumenda beatae accusantium unde nulla minus consequatur,<br> repellat quo quibusdam?</p>
    <div class="h">好好好好好好</div>
</body>

二、列表属性

.r{
           list-style-type:decimal;
           list-style-image: url();
           list-style-position: outside;
       }
.box{
           list-style: circle url() inside;
       }
<div>
        <li class="r">你好啊</li>
        <li class="r">我很好</li>
        <li class="r">那就行</li>
    </div>
<ul class="box">
        <li>你好啊</li>
        <li>我很好</li>
        <li>那就行</li>
    </ul>

 三、背景属性

     6  background-size    背景图片尺寸大小

<style>
.kk{
           height: 400px;
           width: 400px;
           /* rgba透明度 */
           background-color: rgba(246, 45, 100, 0.5);
           background-image: url(../image/ciyun.png);
           background-position: -20px 10%;
           background-position: right bottom;
           /* background-repeat: no-repeat 不平铺;
           background-repeat: repeat-x; x轴平铺
           background-repeat: repeat-y;  y轴平铺*/

           /* 
          1.100% 100%
          2.400px 400px
          3.cover:把背景图像扩展至足够大,以使背景图像完全覆盖背景区域。
          也许无法显示在背景定位区域内
          4.contain:把图像扩展至最大尺寸,以使其宽度和高度完全适应内容区域。
          铺不满盒子,会留白
           */
          background-size: 100% 100%;
       }
    </style>
<div class="bk">
        大家好
        <div class="kk"></div>
    </div>

四、浮动属性

<style>
        div{
            width: 100px;
            height: 100px;
            /*加上 float: left;就可以横向排列了*/
            float: left;
        }
        .red{
            background-color: red;
        }
        .blue{
            background-color: blue;
        }
        .yellow{
            background-color: yellow;
        }
    </style>
</head>
<body class="div">
        <div class="red"></div>
        <div class="blue"></div>
        <div class="yellow"></div>
    </div>
</body>

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值