October 23, 2024
Chicago 12, Melborne City, USA
CSS

CSS to styled component conversion


Does anyone know how to convert this css to a styled component in React. I have problem
with the ‘+ label’ in combination with before and after

[type="checkbox"] {
    opacity: 0;
}

[type="checkbox"] + label {
    position: relative;
    padding-left: 25px;
    cursor: pointer;
    display: inline-block;
    color: #666;
    line-height: 20px;
}

[type="checkbox"] + label::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 14px;
    height: 14px;
    outline: 1px solid #aaa;
    background: white;
}

[type="checkbox"]:checked + label::before {
    content: "";
    position: absolute;
    left: 0;
    top: 0;
    width: 14px;
    height: 14px;
    outline: 1px solid #5fd25f;
    background: white;
}



You need to sign in to view this answers

Leave feedback about this

  • Quality
  • Price
  • Service

PROS

+
Add Field

CONS

+
Add Field
Choose Image
Choose Video