Skip to content

Instantly share code, notes, and snippets.

@zocom-christoffer-wallenberg
Last active January 28, 2020 07:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save zocom-christoffer-wallenberg/072b12d2cd47a1c3e5d220fbce6fb3fa to your computer and use it in GitHub Desktop.
Save zocom-christoffer-wallenberg/072b12d2cd47a1c3e5d220fbce6fb3fa to your computer and use it in GitHub Desktop.
A card with flexbox
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="style.css">
<title>Card with flexbox</title>
</head>
<body>
<section class="card">
<a href="#">X</a>
<div class="img"></div>
<h1>Christoffer</h1>
<p>Wizard</p>
<button>Join me!</button>
</section>
</body>
</html>
body {
width: 100vw;
height: 100vh;
display: flex;
align-items: center;
justify-content: center;
}
.card {
width: 200px;
height: 300px;
border: 1px solid #f8f8f8;
background: #f8f8f8;
display: flex;
flex-direction: column;
align-items: center;
box-shadow: 1px 1px 5px #f2f2f2;
border-radius: 0.25rem;
}
.card a {
text-decoration: none;
color: #999;
margin: 0.5rem 0.5rem auto auto;
}
.card .img {
width: 6rem;
height: 6rem;
background: #999;
border-radius: 50%;
margin: 0 auto 1rem auto;
}
.card h1 {
margin: 0;
padding: 0;
}
.card p {
margin: 0.25rem;
color: #999;
font-size: 0.8rem;
}
.card button {
width: 100%;
height: 40px;
background: #999;
font-size: 1rem;
font-weight: 600;
margin-top: auto;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment