css实现可调背景颜色和亮度的中性文字输入框效果代码

代码语言:html

所属分类:表单美化

代码描述:css实现可调背景颜色和亮度的中性文字输入框效果代码

代码标签: css 中性 输入框

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">

    <link href="https://fonts.googleapis.com/css?family=Oswald:700&display=swap" rel="stylesheet">
    <style>
        body {
      --color:0, 0%;
      --l:100%;
      --color-primary-lightest: hsl(var(--color),var(--l));
      --color-primary-light: hsl(var(--color),calc(var(--l) - 7.5%));
      --color-primary: hsl(var(--color),calc(var(--l) - 10%));
      --color-primary-dark: hsl(var(--color),calc(var(--l) - 15%));
      --color-primary-darkest: hsl(var(--color),calc(var(--l) - 25%));
      display: -webkit-box;
      display: flex;
      height: 100vh;
      width: 100vw;
      -webkit-box-pack: center;
              justify-content: center;
      -webkit-box-align: center;
              align-items: center;
      background-color: var(--color-primary-dark);
    }
    body:before, body:after {
      -webkit-filter: blur(5px);
              filter: blur(5px);
      content: '';
      position: absolute;
      width: 100%;
      height: 100%;
      background: linear-gradient(-45deg, var(--color-primary-darkest) 5%, transparent 50%);
      -webkit-mask: url("data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAEEAAABBCAMAAAC5KTl3AAAAgVBMVEUAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAABtFS1lAAAAK3RSTlMWi3QSa1uQOKBWCTwcb6V4gWInTWYOqQSGfa6XLyszmyABlFFJXySxQ0BGn2PQBgAAC4NJREFUWMMV1kWO5UAQRdFk5kwzs/33v8Cunr7ZUehKAdaRUAse99ozDjF5BqswrPKm7btzJ2tRziN3rMYXC236humIV5Our7nHWnVdFOBojW2XVnkeu1I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sTHPm5IA6bc5ha0gaGkoEttXuxU11B2dOJ65/Q08tEF1+Y9cr2Nh/VECfQ33GyvR/gsdN1LuIeLpKMCAF2yRr769g9/4aJLZNRI71m2S91+Kp+Q0zubTcxoG2/6gm1Q79wkMj2XNO2ui7nWw8ULtu27CCvqTGX2PffD+xcwgh/TrOKvGZMM5jRFGDTn4NO/lwnDR/GY/waDZtkWDUPI0O8ztcFVqp6r2ZW+2bvkJ3raptYagFqu95VdIaml2CIp6CKets34x+fH2C+zH4cVFO7vj+6k2FU39PtRhWluYeZ3gDz1TLB9K2v7SD9gJU1qDxoRDrAWcrFGLyndhdtd0505+gEP79adK8fmFCWNYC+ahzVNcRH79E8dA1iqX/N0qq22xcOc20ALxLDspEj4QCFBQMgaIwoKbxr0Bd7Sbws6GiRK6tqoPfpiCle23axejRLyO1I+ahsEpWrzT5ZsCyS5RcY9jMfENFxSnhKsrfW8JHH6/rdQUMfmQPT3Uz9gY0C/pu1yuCnrPUvio0a1qMEosA/EwIzzid7cqsAAAAASUVORK5CYII=");
      top: 0;
      left: 0;
      opacity: 1;
      z-index: 1;
    }
    body:after {
      background: linear-gradient(135deg, var(--color-primary-light) 5%, transparent 50%);
    }
    body input {
      position: absolute;
      bottom: 10vh;
      z-index: 999;
      -webkit-transform: translateX(150px);
              transform: translateX(150px);
    }
    body input:before {
      content: 'BRIGHTNESS';
      position: absolute;
      width: 100%;
      text-align: center;
      top: -35px;
      left: 0;
      pointer-events: none;
      font-family: 'Oswald';
      color: var(--color-primary-darkest);
    }
    body input:first-of-type {
      -webkit-transform: translateX(-150px);
              transform: translateX(-150px);
    }
    body input:first-of-type:before {
      content: 'HUE';
    }
    body input[type="range"] {
      -webkit-appearance: none;
      width: 200px;
      background: transparent;
      margin-bottom: 10px;
    }
    body input[type="range"]::-webkit-slider-thumb {
      -webkit-appearance: none;
    }
    body input[type="range"]:focus {
      outline: none;
    }
    body input[type="range"]::-ms-track {
      width: 100%;
      cursor: pointer;
      background: transparent;
      border-color: transparent;
      color: transparent;
    }
    body input[type="range"]::-webkit-slider-thumb {
      -webkit-appearance: none;
      height: 16px;
      width: 16px;
      border-radius: 50px;
      cursor: pointer;
      margin-top: -8px;
      background: var(--color-primary-dark);
      box-shadow: -5px -3px 8px var(--color-primary), 6px 2px 12px var(--color-primary-darkest);
    }
    body input[type="range"]:focus::-webkit-slider-thumb:hover {
      background: var(--color-primary-darkest);
    }
    body input[type="range"]::-webkit-slider-runnable-track {
      width: 100%;
      height: 1px;
      cursor: pointer;
      background: var(--color-primary-darkest);
      border-radius: 1.3px;
    }
    body input[type="range"]:focus::-webkit-slider-runnable-track {
      background: var(--color-primary-darkest);
    }
    body textarea {
      position: absolute;
      width: 100vw;
      height: 50vh;
      top: calc(50% - 25vh);
      opacity: 0;
      z-index: 999;
    }
    body textarea::-moz-selection {
      background: transparent;
    }
    body textarea::selection {
      background: transparent;
    }
    body textarea:focus ~ h1 span:not(.text) {
.........完整代码请登录后点击上方下载按钮下载查看

网友评论0