<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="style.css">
</head>
<body>
<div class="table-users">
<div class="header">Users</div>
<table cellspacing="0">
<tr>
<th>Foto</th>
<th>Nombre</th>
<th>Correo</th>
<th>Teléfono</th>
<th width="230">Comentarios</th>
</tr>
<tr>
<td><img src="http://lorempixel.com/100/100/people/1" alt="" /></td>
<td>Jane Doe</td>
<td>jane.doe@foo.com</td>
<td>01 800 2000</td>
<td>Lorem ipsum dolor sit amet, consectetur adipisicing elit. </td>
</tr>
<tr>
<td><img src="http://lorempixel.com/100/100/sports/2" alt="" /></td>
<td>John Doe</td>
<td>john.doe@foo.com</td>
<td>01 800 2000</td>
<td>Blanditiis, aliquid numquam iure voluptatibus ut maiores explicabo ducimus neque, nesciunt rerum perferendis, inventore.</td>
</tr>
</table>
</div>
</body>
</html>
// Code goes here
* { box-sizing: border-box; }
body { font-family: sans-serif; }
.header {
background-color: #ccc;
color: white;
font-size: 1.5em;
padding: 1rem;
text-align: center;
text-transform: uppercase;
}
img {
border-radius: 50%;
height: 60px;
width: 60px;
}
.table-users {
border: 1px solid #ccc;
max-width: calc(100% - 2em);
margin: 5em auto;
width: 800px;
}
table { width: 100%; }
td, th { padding: 10px; }
td {
text-align: center;
vertical-align: middle;
}
td:last-child {
font-size: 0.95em;
line-height: 1.4;
text-align: left;
}
th { background-color: #efefef; }
tr:nth-child(2n) { background-color: white; }
tr:nth-child(2n+1) { background-color: #fafafa; }
@media screen and (max-width: 700px) {
table, tr, td { display: block; }
td:first-child {
position: absolute;
top: 50%;
transform: translateY(-50%);
width: 100px;
}
td:not(:first-child) {
clear: both;
margin-left: 100px;
padding: 4px 20px 4px 100px;
position: relative;
text-align: left;
}
td:not(:first-child):before {
color: #bbb;
content: '';
display: block;
left: 0;
position: absolute;
}
td:nth-child(2):before { content: 'Nombre:'; }
td:nth-child(3):before { content: 'Correo:'; }
td:nth-child(4):before { content: 'Teléfono:'; }
td:nth-child(5):before { content: 'Comentarios:'; }
tr {
padding: 10px 0;
position: relative;
}
tr:first-child { display: none; }
}
@media screen and (max-width: 500px) {
.header {
background-color: transparent;
color: #888;
font-size: 2em;
font-weight: 700;
padding: 0;
text-shadow: 2px 2px 0 rgba(0, 0, 0, 0.1);
}
img {
height: 100px;
margin: 0.5rem 0;
width: 100px;
}
td:first-child,
td:not(:first-child) {
padding: 5px 1em;
width: 100%;
}
td:first-child {
background-color: #efefef;
border-bottom: 1px solid #ddd;
position: relative;
top: 0;
transform: translateY(0);
}
td:not(:first-child) {
margin: 0;
}
td:not(:first-child):before {
display: block;
font-size: .8em;
padding-top: 0.3em;
position: relative;
}
td:last-child { padding-bottom: 1rem; }
tr {
background-color: white !important;
border: 1px solid #ccc;
margin: 0.5rem 0;
padding: 0;
}
.table-users {
border: none;
box-shadow: none;
}
}