Webkit CSS to control the box around the color in an input[type=color]?

后端 未结 11 2039
天涯浪人
天涯浪人 2020-11-28 06:29

Is there a Webkit-specific CSS style that will allow me to control the color/size/style of the box around the color in an input[type=color]?

I\'m setting

11条回答
  •  萌比男神i
    2020-11-28 06:59

    I am using a simple solution, but not so elegant, I guess. You can wrap the input with a div and make the input bigger than the container, after that you can shape the container as you want. You can also use a label with a for attribute to create a clickable button with some text.

    I have made an example:

    .input-color-container {
      position: relative;
      overflow: hidden;
      width: 40px;
      height: 40px;
      border: solid 2px #ffffd;
      border-radius: 40px;
    }
    
    .input-color {
      position: absolute;
      right: -8px;
      top: -8px;
      width: 56px;
      height: 56px;
      border: none;
    }
    
    .input-color-label {
      cursor: pointer;
      text-decoration: underline;
      color: #3498db;
    }

提交回复
热议问题