怎么用css定义部分背景颜色

html-css09

怎么用css定义部分背景颜色,第1张

需要准备的材料分别有:电脑、浏览器、html编辑器。

1、首先,打开html编辑器,新建html文件,例如:index.html。

2、在index.html中的<style>标签中,输入css代码:div{background-color: #0b93d5}。

3、浏览器运行index.html页面,此时成功实现了只在文字的后面又蓝色背景色。

CSS:

.grup{

            padding-top: 104px

            position: relative

            border-radius: 15px

            margin-bottom: 217px

        }

        .grup .img{

            width: 370px

            height: 87px

            position: absolute

            top:-48px

            margin-left: calc(50% - 185px)

            z-index:999

            background: linear-gradient(

            115deg, /*背景分割倾斜角度*/

            #fff 0%,

            #fff 40%,

            #3596EB 40%,

            #3596EB 100%

            )

            border: 4px solid #3596EB

            border-radius: 44px

        }

        .grup .img .coun{

            display: flex

            justify-content: space-around

        }

        .grup .img .coun div{

            display: flex

            line-height: 88px

        }

        .grup .img .coun .left{

            color:#3596EB

            font-size: 32px

            letter-spacing: 3px

            font-weight: 500

        }

        .grup .img .coun .right{

            color:#fff

            font-size: 28px

            letter-spacing: 3px

            font-weight: 500

        }

HTML:

<div class="up grup">

              <div class="img">

                <div class="coun">

                    <div class="left">新建</div>

                    <div class="right">所有文集</div>

                </div>

              </div>

            </div>

效果: