↑ ↓ navigate↵ selectesc close

Material Checkbox without Material UI (only CSS)

Lesson 4 / 6Course Lessons Outline
▾

The main HTML is very simple, having just two key elements input and span.

<label>
	<input type="checkbox" />
	<span class="checkbox"></span>
</label>

In order to create the checkmark it is nothing more than a bottom, and left border colored green. The key here is that it is then rotated 45deg to make it look like a check mark.

input:checked ~ .checkbox {
	transform: rotate(45deg);
	height: 125px;
	width: 50px;
	margin-left: 50px;
	border-color: green;
	border-top-color: transparent;
	border-left-color: transparent;
	border-radius: 0;
}

This JavaScript is not required, it shows the checked status.

const input = Array.from(document.getElementsByTagName('input')).at(0);

const result =   document.getElementById('result');
input.addEventListener('input', () => {
  input.checked ? result.innerHTML = 'Checked: true' : result.innerHTML = 'Checked: false'
})

Below is a fully working example!

✏️ Visual Architecture Diagram

how this course connects together.

Follow AJ through the layered stack topology from input contract to production output.

✏️ Architecture Diagram: CSS Animations: Material Checkbox without Materi…
LAYERED SYSTEM STACKARCHITECTURE DIAGRAM
Architecture Diagram: CSS Animations: Material Checkbox without Materi…LAYERED SYSTEM STACK showing: Node 1: Inputs (Schema & deterministic boundary) -> Node 2: CSS Animations (Execution & state transitions) -> Node 3: Verified Production Artifact (Production output & telemetry). Content-driven layered-stack diagram for CSS Animations: Material Checkbox without Material UI (only CSS): Inputs -> CSS Animations -> Verified Production Artifact.STAGE 01InputsSchema & deterministic boundary1. InputsSTAGE 02CSS AnimationsExecution & state transitions2. CSS AnimationsSTAGE 03Verified Production ArtifactProduction output & telemetryTyped Contract
[Diagram Walkthrough]Content-driven layered-stack diagram for CSS Animations: Material Checkbox without Material UI (only CSS): Inputs -> CSS Animations -> Verified Production Artifact.
AAA Contrast Verified


related deep dives.

View All→