Beispiel:Button mit CSS-2.html

Aus SELFHTML-Wiki
Wechseln zu: Navigation, Suche
<!DOCTYPE html>
<html>
<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>CSS-Buttons</title>
	<style>
			form {
				max-width: 800px;
				height: 600px;
				box-sizing: border-box;
				font-family: sans-serif;
				color: white;
				background: url(/images/b/b5/Dj.jpg) darkblue;
				margin: 3em auto -1em;
				padding: 3em;
				border-radius: 0 1em 1em;
			}
			form h2 {
				color: white;
			}
			p.choice {
				margin-top: 6em;
			}
			button {
				position: relative;
				margin: 2em;
				padding: .5em 1em;
				width: 8em;
				background: transparent;
				color: white;
				border: thin solid white;
				border-radius: .2em;
				cursor: pointer;
				transition: all ease 2s;
			}
			button:hover, button:active {
				outline: none;
				background: white;
				color: darkblue;
			}
			button::before, button::after {
				position: absolute;
				width: 100%;
				height: 150px;
				left: 0;
				color: white;
			}
			button::before {
				content: " ";
				top: -120px;
				background: none center no-repeat transparent;
				background-size: 30px 30px;
				transition: all ease 1s;
				transform: rotate(0deg);
			}
			button:hover::before {
				background-size: 80px 80px;
				transform: rotate(360deg);
			}
			button::after {
				bottom: -520%;
				transition: transform ease-in .5s, opacity ease-out 1s;
			}
			#win::before {
				background-image: url(/images/2/29/Win.png);
			}
			#and::before {
				background-image: url(/images/3/32/And.png);
			}
			#mac::before {
				background-image: url(/images/6/69/Mac.png);
			}
			#win::after {
				content: "7, 9, 10";
				transform: translatex(-200%);
				opacity: 0;
			}
			#win:hover::after {
				transform: translatex(0);
				opacity: 1;
			}
			#and::after {
				content: "4.3, 4.4, 5.0";
				transform: translatey(200px);
				opacity: 0;
			}
			#and:hover::after {
				transform: translatey(0);
				opacity: 1;
			}
			#mac::after {
				content: "iOS 7, iOS 8";
				transform: translatex(200%);
				opacity: 0;
				transition: transform ease-in .5s, opacity ease-out 1s;
			}
			#mac:hover::after {
				transform: translatex(0);
				opacity: 1;
			}
		</style>
</head>
<body>
	<h1>Button-Gestaltung mit CSS</h1>

	<form>
		<h2>Download</h2>
		<p>Hier können Sie unser Produkt herunterladen.</p>
		<p>Wählen Sie Ihr Betriebssystem.</p>
		<p class="choice">
			<button id="win">Windows</button>
			<button id="and">Android</button>
			<button id="mac">Apple</button>
		</p>
	</form>
	<h2>Bildquellen</h2>
	<p>Dieses Beispiel verwendet folgende Bilder:</p>
	<ul>
		<li><a href="http://lorempixel.com/output/nightlife-q-c-800-600-5.jpg">http://lorempixel.com/output/nightlife-q-c-800-600-5.jpg</a></li>
		<li><a href="https://de.wikipedia.org/wiki/Datei:Android_robot.svg">https://de.wikipedia.org/wiki/Datei:Android_robot.svg</a></li>
		<li><a href="https://de.wikipedia.org/wiki/Datei:Apple_logo_black.svg">https://https://de.wikipedia.org/wiki/Datei:Apple_logo_black.svg</a></li>
		<li><a href="https://commons.wikimedia.org/wiki/File:Windows_logo_-_2012.svg">https://commons.wikimedia.org/wiki/File:Windows_logo_-_2012.svg</a></li>
	</ul>
</body>
</html>