Published on February 19, 2021 Updated on June 13, 2024

Creating a card with HTML and CSS

Here’s a simple way to create a card using HTML and CSS.


<div class="card">
	<h1>Card title</h1>
	<p>This is the text</p>
	<div class="action-buttons">


.card {
	width: 30%;
	max-width: 30%;
	padding: 10px;
	border-radius: 4px;
	box-shadow: 0px 5px 50px #0040ff2b;
	background: #0040ff00;
	font-family: product sans;
.card img {
	max-width: 105%;
	width: 105%;
	margin-left: -11px;
.card h1 {
	text-align: center;
	font-size: 36px;
	text-indent: 0px;
	height: 100%;
.card p {
	text-align: center;
.action-buttons {
	text-align: right;
	padding: 9px;
	width: 100%;
	background: #f0f0f0;
	margin-left: -9px;
	margin-top: 20px;
button {
	padding: 10px 20px;
	background: #007cff;
	border: none;
	color: white;
	border-radius: 4px;
	box-shadow: 0px 4px 10px #0040ff4d;
	font-size: 14px;
	transition: all 0.2s;
	outline: none;
button:hover {
	background: #0058ff;

Something wrong or just found a typo? Edit this page on GitHub and make a PR!