web-html5-scripts/buttons-and-toggles/power-switch-animation/index.html

39 lines
1.1 KiB
HTML
Raw Permalink Normal View History

2020-01-20 21:00:54 +01:00
<!DOCTYPE html>
<html lang="en" >
<head>
<meta charset="UTF-8">
2020-02-03 20:51:43 +01:00
<meta name="viewport" content="width=device-width, initial-scale=1">
2020-01-20 21:00:54 +01:00
<title>Power switch animation - Only CSS</title>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css">
<link rel="stylesheet" href="./style.css">
</head>
<body>
<div class="power-switch">
<input type="checkbox" />
<div class="button">
<svg class="power-off">
<use xlink:href="#line" class="line" />
<use xlink:href="#circle" class="circle" />
</svg>
<svg class="power-on">
<use xlink:href="#line" class="line" />
<use xlink:href="#circle" class="circle" />
</svg>
</div>
</div>
<!-- SVG -->
<svg xmlns="http://www.w3.org/2000/svg" style="display: none;">
<symbol xmlns="http://www.w3.org/2000/svg" viewBox="0 0 150 150" id="line">
<line x1="75" y1="34" x2="75" y2="58"/>
</symbol>
<symbol xmlns="http://www.w3.org/2000/svg" viewBox="0 0 150 150" id="circle">
<circle cx="75" cy="80" r="35"/>
</symbol>
</svg>
</body>
</html>