Beispiel:Viewport-Units-2.html

Aus SELFHTML-Wiki
Wechseln zu: Navigation, Suche

<!doctype html> <html lang="de"> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title>Viewport-Einheiten - 2 </title>

<style>

body {

 font-family: sans-serif;
 margin: 2rem;
 font-size: max(2.5vw, 1.5rem);

}

h1 {

 font-size: clamp(2.5rem, 5vw, 5rem);

}

pre {

 background: steelblue;
 color: white;
 padding: 2rem;

width: min-content; } </style> </head>

<body>

Viewport-Einheiten - 2

Flexible Schriftgrößen, die sich am Viewport orientieren.

h1 {
  font-size: clamp(2.5rem, 5vw, 5rem);
}

</body>

</html>