The HTML structure of a price card is the foundation that holds all the content. A basic price card usually consists of a container element (like a <div>
), which includes a title, price, features list, and a call - to - action button.
<div class="price - card">
<h2 class="card - title">Basic Plan</h2>
<p class="card - price">$9.99/month</p>
<ul class="card - features">
<li>1GB Storage</li>
<li>10 Email Accounts</li>
<li>Basic Support</li>
</ul>
<a href="#" class="card - button">Sign Up</a>
</div>
CSS is used to style the price card and make it visually appealing. It can be used to set the background color, font size, border, and spacing of different elements within the price card.
.price - card {
border: 1px solid #ccc;
border - radius: 5px;
padding: 20px;
width: 300px;
text - align: center;
}
.card - title {
font - size: 24px;
margin - bottom: 10px;
}
.card - price {
font - size: 30px;
color: #007BFF;
margin - bottom: 20px;
}
.card - features {
list - style: none;
padding: 0;
margin - bottom: 20px;
}
.card - features li {
margin - bottom: 10px;
}
.card - button {
background - color: #007BFF;
color: white;
padding: 10px 20px;
border - radius: 5px;
text - decoration: none;
}
.card - button:hover {
background - color: #0056b3;
}
To use a single price card, simply copy the HTML and CSS code into your project. Place the HTML code in your .html
file and the CSS code in your .css
file or within a <style>
tag in the HTML file.
To display multiple price cards side by side, you can use CSS flexbox or grid layout.
<div class="price - card - container">
<div class="price - card">
<h2 class="card - title">Basic Plan</h2>
<p class="card - price">$9.99/month</p>
<ul class="card - features">
<li>1GB Storage</li>
<li>10 Email Accounts</li>
<li>Basic Support</li>
</ul>
<a href="#" class="card - button">Sign Up</a>
</div>
<div class="price - card">
<h2 class="card - title">Pro Plan</h2>
<p class="card - price">$19.99/month</p>
<ul class="card - features">
<li>5GB Storage</li>
<li>50 Email Accounts</li>
<li>Premium Support</li>
</ul>
<a href="#" class="card - button">Sign Up</a>
</div>
</div>
.price - card - container {
display: flex;
justify - content: center;
gap: 20px;
}
Make sure your price cards are responsive so that they look good on different screen sizes. You can use media queries in CSS to adjust the layout and styling of the price cards based on the screen width.
@media (max - width: 768px) {
.price - card - container {
flex - direction: column;
align - items: center;
}
}
You can highlight the best - value or most popular price card by adding a special class to it. For example:
.price - card.popular {
border: 2px solid #007BFF;
box - shadow: 0 0 10px rgba(0, 123, 255, 0.5);
}
<div class="price - card popular">
<!-- Price card content -->
</div>
Avoid overcrowding the price card with too much information. Keep the design clean and easy to understand. Only display the most important features and pricing details.
Maintain a consistent color scheme, font family, and spacing throughout all your price cards. This will create a cohesive look and make your website more professional.
Ensure that your price cards are accessible to all users. Use proper contrast ratios between text and background colors, and provide alternative text for any images used.
Price cards are an essential part of web design for presenting pricing information effectively. By understanding the fundamental concepts of HTML and CSS for price cards, knowing the usage methods, following common practices, and implementing best practices, you can create visually appealing and user - friendly price cards. These price cards can enhance the user experience on your website and help drive conversions.