Dynamically change color to lighter or darker by percentage CSS (Javascript)

后端 未结 24 1799
-上瘾入骨i
-上瘾入骨i 2020-11-28 01:12

We have a big application on the site and we have a few links which are, let\'s say blue color like the blue links on this site. Now I want to make some other links, but wit

24条回答
  •  盖世英雄少女心
    2020-11-28 01:42

    I know it's late but, you could use a wrapper to your buttons and change a rgba color function opacity level, as said in other answers but with no explicit example.

    Here's a pen:

    https://codepen.io/aronkof/pen/WzGmjR

    #wrapper {
      width: 50vw;
      height: 50vh;
      background-color: #AAA;
      margin: 20px auto;
      border-radius: 5px;
      display: grid;
      place-items: center;
    } 
    
    .btn-wrap {
      background-color: #000;
      display: inline-block;
    }
    
    button {
      transition: all 0.6s linear;
      background-color: rgba(0, 255, 0, 1);
      border: none;
      outline: none;
      color: #fff;
      padding: 50px;
      font-weight: 700;
      font-size: 2em;
    }
    
    button:hover {
      background-color: rgba(0, 255, 0, .5);
    }

提交回复
热议问题