32 lines
876 B
HTML
32 lines
876 B
HTML
<!DOCTYPE html>
|
|
<html lang="de">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<title>div vs button</title>
|
|
<style>
|
|
body { font-family: system-ui, sans-serif; padding: 1.2rem; }
|
|
h3 { margin: 0.8rem 0 0.4rem; font-size: 1rem; }
|
|
.bad { color: #b91c1c; }
|
|
.good { color: #15803d; }
|
|
.button {
|
|
display: inline-block;
|
|
background: #e5e7eb;
|
|
border: 1px solid #9ca3af;
|
|
padding: 6px 14px;
|
|
cursor: pointer;
|
|
border-radius: 4px;
|
|
}
|
|
button { font: inherit; padding: 6px 14px; }
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<h3 class="bad">Schlecht (div)</h3>
|
|
<div class="button" onclick="alert('!')">Klick mich</div>
|
|
<p><small>❌ Tab überspringt, kein Enter, kein Screenreader</small></p>
|
|
|
|
<h3 class="good">Gut (button)</h3>
|
|
<button type="button">Klick mich</button>
|
|
<p><small>✅ Tastatur + Screenreader eingebaut</small></p>
|
|
</body>
|
|
</html>
|