결과이미지

html(index.html)
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Custom Checkboxes</title>
    <link rel="stylesheet" href="styles.css">
</head>
<body>
    <h2>Basic Checkbox</h2>
    <label class="basic-checkbox">
        <input type="checkbox" checked>
        <span class="checkmark"></span>
        Basic Checkbox
    </label>
    <h2>Round Checkbox</h2>
    <label class="round-checkbox">
        <input type="checkbox">
        <span class="checkmark"></span>
        Round Checkbox
    </label>
    <h2>Custom Checkbox</h2>
    <label class="custom-checkbox">
        <input type="checkbox">
        <span class="checkmark"></span>
        Custom Checkbox
    </label>
</body>
</html>
CSS(styles.css)
body {
    font-family: Arial, sans-serif;
}
.basic-checkbox,
.round-checkbox,
.custom-checkbox {
    display: block;
    position: relative;
    padding-left: 35px;
    margin-bottom: 12px;
    cursor: pointer;
    font-size: 22px;
    user-select: none;
}
.basic-checkbox input,
.round-checkbox input,
.custom-checkbox input {
    position: absolute;
    opacity: 0;
    cursor: pointer;
}
.basic-checkbox .checkmark,
.round-checkbox .checkmark,
.custom-checkbox .checkmark {
    position: absolute;
    top: 0;
    left: 0;
    height: 25px;
    width: 25px;
    background-color: #eee;
}
.basic-checkbox:hover input ~ .checkmark,
.round-checkbox:hover input ~ .checkmark,
.custom-checkbox:hover input ~ .checkmark {
    background-color: #ccc;
}
.basic-checkbox input:checked ~ .checkmark,
.round-checkbox input:checked ~ .checkmark,
.custom-checkbox input:checked ~ .checkmark {
    background-color: #2196F3;
}
.basic-checkbox .checkmark:after,
.round-checkbox .checkmark:after,
.custom-checkbox .checkmark:after {
    content: "";
    position: absolute;
    display: none;
}
.basic-checkbox input:checked ~ .checkmark:after,
.round-checkbox input:checked ~ .checkmark:after,
.custom-checkbox input:checked ~ .checkmark:after {
    display: block;
}
.basic-checkbox .checkmark:after,
.round-checkbox .checkmark:after,
.custom-checkbox .checkmark:after {
    left: 9px;
    top: 5px;
    width: 5px;
    height: 10px;
    border: solid white;
    border-width: 0 3px 3px 0;
    transform: rotate(45deg);
}
.round-checkbox .checkmark {
    border-radius: 50%;
}
.round-checkbox input:checked ~ .checkmark:after {
    left: 8px;
    top: 4px;
    width: 10px;
    height: 20px;
    border: solid white;
    border-width: 0 4px 4px 0;
    transform: rotate(45deg);
}
.custom-checkbox .checkmark {
    background-color: #ffcc00;
    border-radius: 5px;
    box-shadow: 0 0 5px rgba(0,0,0,0.5);
}
.custom-checkbox:hover input ~ .checkmark {
    background-color: #ff9900;
}
.custom-checkbox input:checked ~ .checkmark {
    background-color: #00cc66;
}
.custom-checkbox input:checked ~ .checkmark:after {
    left: 8px;
    top: 4px;
    width: 10px;
    height: 20px;
    border: solid white;
    border-width: 0 4px 4px 0;
    transform: rotate(45deg);
}반응형
    
    
    
  '프로그램 > 체크박스(checkbox)' 카테고리의 다른 글
| Simple Checkbox Styling(체크박스) (0) | 2024.01.31 | 
|---|---|
| CSS only minimal checkbox and switches(체크박스) (0) | 2024.01.31 | 
| Skeuomorphic Setting Switches(체크바스) (0) | 2024.01.31 | 
| Checkbox Stunts - FAQ CSS Only (체크박스) (0) | 2024.01.31 | 
| 32 Good Cheap Fast(체크박스) (0) | 2024.01.31 | 
 
										
									 
										
									 
										
									 
										
									
댓글