Web实现:背景颜色渐变色

HTML部分:

DOCTYPE html>
<html>
  <head>
    <meta charset="utf-8" />
    <link rel="stylesheet" type="text/css" href="./index.css" />
  head>
  <body>
    <button class="publish">我要提问button>
  body>
html>

CSS部分:

.publish {
  width: 100%;
  height: 50px;
  line-height: 50px;


    /*渐变方向*/
  background: linear-gradient(to right, #95ca47, #4dc891);/*从左到右*/
  background: linear-gradient(to left bottom, #95ca47, #4dc891);/*从右上到左下*/
  
    /*渐变位置*/
  background: linear-gradient(to right, #95ca47 30%, #4dc891 70%);/*百分比用来约定渐变的起止位置*/
  color: #fff;
  font-size: 18px;
  border-radius: 4px;
  font-weight: 500;
  box-shadow: 0 2px 6px 0 rgba(104, 200, 116, 0.3); /*1*/
}

你可能感兴趣的:(CSS,HTML,笔记,前端,css,html)