Beispiel:CSS-Anw-Tabelle-6.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">
  <style>
table {
  border-collapse: separate;
  border-spacing: 0.2em;
  margin-left:2em;
  box-shadow: 0 0 0.1em #666;
  position: relative;
  z-index:1;
}
  
th,td {
  padding: 0.2em 0.5em;
  border-radius: 0.1em;  
}  

thead th {
  background-color: #ffebe6;
  color: #c32e04;
}

td {
  font-style:italic;
  text-align: right;
  box-shadow: inset 1px 3px 5px -3px rgba(0,0,0,0.5);
}   

tbody tr:nth-child(even)  { 
  background-color: #e4ebf2; 
  color: #000; 
}

td:empty{
  box-shadow: none;
  background-color:none;
}

th[scope=row] { 
  color: #c32e04;
  text-align: right; 
  background-color: #fff;
}

caption {
	color: white;
	background: #c32e04;
	font-size: 1.5em;
	box-shadow: 0.1em 0.1em 0.1em 0 hsl(0, 0%, 50%);
	padding: 0.2em 0.2em 0.2em 2em;
	width: 10em;
	margin-left: -.6em;
	position: relative;
}

caption::before {
	content: "";
	position: absolute;
	display: block;
	height: 0;
	width: 0;
	top: 1em;
	left: -0.6em;
	border-style: solid;
	border-width: 0.6em;
	border-color: transparent hsl(13, 96%, 35%) transparent transparent;
	z-index: -1;
}

tbody tr:hover, tfoot tr:hover { 
  background-color:#fffbf0;
}

tbody td:hover, tfoot td:hover { 
  background-color: #fce4a2; 
} 


  </style>
  <title>Tabellen mit CSS gestalten 6</title>
</head>

<body>
<h1>Beispieltabelle</h1>
  <table>
	<caption>Browser-Statistik 2015</caption>

	<thead>
		<tr>
			<td rowspan="2"></td>
			<th scope="col" rowspan="2">Chrome</th>
			<th scope="col" rowspan="2">Firefox</th>
			<th scope="colgroup" colspan="3">Internet Explorer</th>
            <th scope="col" rowspan="2">Egde</th>
			<th scope="col" rowspan="2">Opera</th>
			<th scope="col" rowspan="2">Safari</th>
		</tr>
		<tr>
			<th scope="col">IE 8</th>
			<th scope="col">IE 9</th>            
			<th scope="col">IE 10-11</th>
		</tr>
	</thead>
	
	<tbody>
		<tr>
			<th scope="row">Juli</th>
			<td>25,7%</td>
			<td>30,4%</td>
			<td>0,9%</td>
			<td>1,3%</td>
			<td>8,3%</td>
			<td>0,1%</td>            
			<td>1,5%</td>
			<td>22,6%</td>
		</tr>
		<tr>
			<th scope="row">August</th>
			<td>26,2%</td>
			<td>29,6%</td>
			<td>0,7%</td>
			<td>1,2%</td>
			<td>7,5%</td>
			<td>0,8%</td>            
			<td>1,6%</td>
			<td>22,8%</td>
		</tr>        
		<tr>
			<th scope="row">September</th>
			<td>25,9%</td>
			<td>29,8%</td>
			<td>0,5%</td>
			<td>1,2%</td>
			<td>7,5%</td>
			<td>1,0%</td>            
			<td>2,2%</td>
			<td>22,0%</td>
		</tr>
		<tr>
			<th scope="row">Oktober</th>
			<td>26,1%</td>
			<td>29,5%</td>
			<td>0,5%</td>
			<td>1,0%</td>
			<td>7,7%</td>
			<td>1,1%</td>            
			<td>2,5%</td>
			<td>20,8%</td>
		</tr>
		<tr>
			<th scope="row">November</th>
			<td>26,3%</td>
			<td>30,6%</td>
			<td>0,4%</td>
			<td>0,9%</td>
			<td>7,6%</td>
			<td>1,3%</td>            
			<td>3,1%</td>
			<td>18,6%</td>
		</tr>
		<tr>
			<th scope="row">Dezember</th>
			<td>26,1%</td>
			<td>28,6%</td>
			<td>0,3%</td>
			<td>0,8%</td>
			<td>7,7%</td>
			<td>1,5%</td>            
			<td>2,9%</td>
			<td>19,9%</td>
		</tr>
	</tbody>

	<tfoot>
		<tr>
			<th scope="row">Durchschnitt</th>
			<td>26,2%</td>
			<td>29,9%</td>
			<td>0,6%</td>
			<td>1,0%</td>
			<td>7,8%</td>
			<td>1.1%</td>
			<td>2,4%</td>
			<td>20,2%</td>            

		</tr>
	</tfoot>
  </table>
  
  <p>Quelle: <a href="https://www.browser-statistik.de/statistiken/versionen/">www.browser-statistik.de</a></p>

</body>
</html>