css入门 常用属性

style常用属性

  1. 颜色
  • 前景色:color
  • 背景色:background-color
  1. 字体
  • 字体大小:font-size
  • 字体粗细:font-weight
  1. 边框
  • border格式:宽度 样式 颜色;
  • 样式:solid 实线;dotted 点线;dashed 虚线
  • border-&:边框
    例:border:1px solid red;
    border-top:1px dashed red;
  • border-radius:圆角
  1. 外边框
  • margin
  • margin-&:外边框
    例:margin-top:10px;
  1. 内补
  • padding
  • padding-&:内补
    例:padding-top:10px;
  1. 宽高
  • width:宽
  • height:高
  1. 文本
  • text-align:center;水平居中
  • height-align=line-height:center;垂直居中
  • text-decoration:none;去除下划线
  1. 显示
  • display属性
    • inline 不换行
    • block 块元素
    • inline-block 行内块
    • none 不显示
  1. 列表
  • list-style:none;去除列表样式
  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>
    <!-- 
    颜色:color: 前景色
          background-color: 背景色
    字体:font-size: 字体大小
        font-weight: 字体粗细
    边框: border: 1px solid red  border-*  边框
          border-radius: 圆角
    外边距:margin margin-*  外边距
    内补: padding padding-*  内补
    宽高:width height 宽高
    文本:text-align  水平居中  center
         height=lineheight 垂直居中
         text-decoration  none 去除下划线
    显示:display  inline不换行  block块元素  inline-block行内块  none不显示
    列表:list-style none去除列表样式
 -->

    <style>
        li{
            list-style: none;
        }
        .wrapper{
            width: 300px;
            margin: 0 auto;
            border: 1px solid lightcoral;
            padding: 10px 20px 10px 50px;
            text-align: center;
            background-color: lightblue;
            border-radius: 5%;
        }
        .first a{
            text-decoration: none;
        }
        .first li:nth-of-type(2){
            font-size: 10px;
            font-weight: lighter;
        }
        .second{
            color: red;
        }
        .third li{
            display: inline-block;
        }
    </style>
</head>
<body>
    <div class="wrapper">
        <div class="first">
            <a href="#"><li>赋得古原草送别</li></a>
            <li>白居易</li>
        </div>
        <div class="second">
            <li>离离原上草,一岁一枯荣。</li>
            <li>野火烧不尽,春风吹又生。</li>
            <li>远芳侵古道,晴翠接荒城。</li>
            <li>又送王孙去,萋萋满别情。</li>
        </div>
        <div class="third">
            <ul>
                <li>1</li>
                <li>2</li>
                <li>3</li>
                <li>4</li>
                <li>5</li>
                <li>6</li>
            </ul>
        </div>
    </div>
</body>
</html>

11 效果图
css常用在这里插入图片描述

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值