Beispiel:CSS3 box-sizing.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.0">
	<link rel="stylesheet" media="screen" href="./Beispiel:SELFHTML-Beispiel-Grundlayout.css" >
	<title>box-sizing</title>
<style>
body {
	text-align: center;
}

section {
	background: lightgreen;
	background-clip: content-box;
	border: 1em solid green;
	padding: 1em;
	margin: 2em auto 0.2em;
	width: 20em;
}

section code {
	display: block;
	margin: 4em 0;
}

#content-box {
	box-sizing: content-box;
}

#border-box {
	box-sizing: border-box;
}

aside {
	display: block;
	box-sizing: border-box;
	width: 20em;
	position: relative;
	top: -2.2em;
	margin: 0.2em auto 2em;
	border-width: thin;
	border-color: black;
	border-style: none dashed solid dashed;
	padding-top: 2em;
}
</style>
</head>
<body>
	<h1>Verwendung von <code>box-sizing</code></h1>
	<section id="content-box">
		<code>width: 20em;<br>box-sizing: content-box;</code>
	</section>
	<aside><code>← 20em →</code></aside>
	<section id="border-box">
		<code>width: 20em;<br>box-sizing: border-box;</code>
	</section>
	<aside><code>← 20em →</code></aside>
		
</body>
</html>