This features section HTML CSS tutorial shows you how to build a clean two-column grid of feature cards with icons, headings, and descriptions. Each card pins its highlight line to the bottom using margin-block-start: auto, so all four cards stay aligned. I also cover accessibility basics like aria-labelledby and empty alt text for decorative icons, and the layout collapses to one column on mobile.
Final preview:
The details make the difference
A pack that works for you.
Practical features. Nothing extra. Just what you need to make getting out the door a little easier.
A place for everything
A padded laptop sleeve, an easy-access front pocket, and room for the things you carry every day.
Dedicated 16″ laptop sleeve
Ready for a little rain
Water-resistant fabric and a roll-top closure help keep your belongings dry when the weather turns.
Water-resistant outer fabric
Comfort that carries
Cushioned shoulder straps and a breathable back panel make a full pack easier to carry.
Padded, adjustable straps
More room when you need it
Unroll the top for a little extra space. Roll it back down when you’re just taking the essentials.
Flexible 20-28L capacity
Steps for Features Section HTML CSS:
1. Set Up the Section and Base Styles
Link the Inter font from Google Font in the head.
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Inter:ital,opsz,wght@0,14..32,100..900;1,14..32,100..900&display=swap" rel="stylesheet">
Let’s start with a section element with the class features-section. Inside it, I am adding a .section-container div with a .features-header and a .feature-cards-wrapper.
<section class="features-section" aria-labelledby="features-heading">
<div class="section-container">
<div class="features-header"></div>
<div class="feature-cards-wrapper"></div>
</div>
</section>
Then reset the margins and the padding, and define the colors as CSS variables on :root. Next, use clamp() on the vertical padding, and set the inline padding to 5%. Finally, center the container with the margin inline property set to auto and a max width.
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
:root {
--color-bg-primary: hsl(120 7% 97%);
--color-bg-secondary: hsl(0 0% 100%);
--color-text-primary: hsl(146 10% 14%);
--color-text-secondary: hsl(129 3% 40%);
--color-text-tertiary: hsl(151 14% 35%);
--color-border-primary: hsl(120 8% 88%);
}
body {
font-family: "Inter", sans-serif;
}
.features-section {
padding-block: clamp(4rem, calc(1rem + 6.67vw), 7rem);
padding-inline: 5%;
background-color: var(--color-bg-primary);
color: var(--color-text-primary);
.section-container {
max-width: 67.5rem;
margin-inline: auto;
}
}
Note:
aria-labelledby. It points to the id of the heading, which is features-heading here. As a result, screen readers announce the section as “A pack that works for you.”
padding-block and padding-inline. These are logical properties. block means top and bottom, and inline means left and right. They adapt automatically to right-to-left languages.
2. Build the Header
Next, fill in .features-header with a label, a heading, and a description.
<div class="features-header">
<p class="section-label">The details make the difference</p>
<h2 id="features-heading">A pack that works for you.</h2>
<p class="features-description">Practical features. Nothing extra. Just what you need to make getting out the door a little easier.</p>
</div>
Set a max width on the header, so the text never stretches too wide. Then style the label with a small medium weight and the tertiary color. For the heading, I am using clamp() on the font size, plus a tight line height and a slightly negative letter spacing. Use the margin block start property to space each element from the one above it.
.features-section {
.features-header {
max-width: 35rem;
.section-label {
font-weight: 500;
font-size: .875rem;
line-height: 1.4;
color: var(--color-text-tertiary);
}
h2 {
margin-block-start: 1rem;
font-weight: 600;
font-size: clamp(2rem, calc(1rem + 1.94vw), 2.75rem);
line-height: 1.15;
letter-spacing: -0.0264em;
}
.features-description {
margin-block-start: 1.25rem;
font-size: 1rem;
line-height: 1.75;
color: var(--color-text-secondary);
max-width: 30rem;
}
}
}
Note:
margin-block-start. It means “margin on the top” in the writing direction. Using it instead of margin-top keeps your layout correct if the language flows differently.
Output:
The details make the difference
A pack that works for you.
Practical features. Nothing extra. Just what you need to make getting out the door a little easier.
3. Create the Cards Grid
Now fill in .feature-cards-wrapper with four .feature-card divs. Each card has an icon, a heading, a description, and a highlight line.
<div class="feature-cards-wrapper">
<div class="feature-card">
<img src="laptop-sleeve.png" alt="">
<h3>A place for everything</h3>
<p>A padded laptop sleeve, an easy-access front pocket, and room for the things you carry every day.</p>
<p class="feature-highlight">Dedicated 16″ laptop sleeve</p>
</div>
<!-- add more cards -->
</div>
Use a two-column grid on the wrapper with a gap, so the cards sit in a neat 2 by 2 layout. On small screens, collapse to a single column.
.feature-cards-wrapper {
margin-block-start: 2.75rem;
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 1.25rem;
@media (width < 600px) {
grid-template-columns: 1fr;
}
}
Note:
empty alt. The icons are decorative, since the heading beside each one already explains the feature. So alt=”” tells screen readers to skip them. If an image carried meaning, you would describe it here.
Output:
The details make the difference
A pack that works for you.
Practical features. Nothing extra. Just what you need to make getting out the door a little easier.
A place for everything
A padded laptop sleeve, an easy-access front pocket, and room for the things you carry every day.
Dedicated 16″ laptop sleeve
Ready for a little rain
Water-resistant fabric and a roll-top closure help keep your belongings dry when the weather turns.
Water-resistant outer fabric
Comfort that carries
Cushioned shoulder straps and a breathable back panel make a full pack easier to carry.
Padded, adjustable straps
More room when you need it
Unroll the top for a little extra space. Roll it back down when you’re just taking the essentials.
Flexible 20-28L capacity
4. Style the Card
Next, give each card a white background, a thin border, and rounded corners. Use flexbox with the flex direction property set to column. This matters because the highlight line gets pushed to the bottom in the next step. Reduce the padding on small screens.
.feature-card {
background-color: var(--color-bg-secondary);
border: 1px solid var(--color-border-primary);
border-radius: .5rem;
padding: 2rem 2rem 1.5rem;
display: flex;
flex-direction: column;
@media (width < 600px) {
padding: 1.25rem 1.25rem 1rem;
}
img {
width: 2rem;
height: 2rem;
}
h3 {
margin-block-start: 1.75rem;
font-weight: 600;
font-size: 1.25rem;
line-height: 1.4;
letter-spacing: -0.02em;
}
}
Output:
The details make the difference
A pack that works for you.
Practical features. Nothing extra. Just what you need to make getting out the door a little easier.
A place for everything
A padded laptop sleeve, an easy-access front pocket, and room for the things you carry every day.
Dedicated 16″ laptop sleeve
Ready for a little rain
Water-resistant fabric and a roll-top closure help keep your belongings dry when the weather turns.
Water-resistant outer fabric
Comfort that carries
Cushioned shoulder straps and a breathable back panel make a full pack easier to carry.
Padded, adjustable straps
More room when you need it
Unroll the top for a little extra space. Roll it back down when you’re just taking the essentials.
Flexible 20-28L capacity
5. Style the Description and Highlight
Finally, style the description paragraph. Here I am using :not(.feature-highlight), so the rule skips the highlight line, even though both are p tags. Then set the margin block start property to auto on the highlight. As a result, it always sits at the bottom of the card, so all four cards line up even when the text length differs. Add a top border to separate it from the text.
.feature-card {
p:not(.feature-highlight) {
margin-block: .75rem 1.75rem;
font-size: 1rem;
line-height: 1.6;
color: var(--color-text-secondary);
max-width: 25rem;
}
.feature-highlight {
margin-block-start: auto;
padding-block-start: 1rem;
font-size: .875rem;
line-height: 1.4;
color: var(--color-text-tertiary);
border-top: 1px solid var(--color-border-primary);
}
}
Note:
:not(). It selects everything except what is inside the brackets. It saves you from adding an extra class to every normal paragraph.
margin: auto in flexbox. An auto margin soaks up all the free space on that side. So margin-block-start: auto pushes the element to the bottom of a column.
Output:
The details make the difference
A pack that works for you.
Practical features. Nothing extra. Just what you need to make getting out the door a little easier.
A place for everything
A padded laptop sleeve, an easy-access front pocket, and room for the things you carry every day.
Dedicated 16″ laptop sleeve
Ready for a little rain
Water-resistant fabric and a roll-top closure help keep your belongings dry when the weather turns.
Water-resistant outer fabric
Comfort that carries
Cushioned shoulder straps and a breathable back panel make a full pack easier to carry.
Padded, adjustable straps
More room when you need it
Unroll the top for a little extra space. Roll it back down when you’re just taking the essentials.
Flexible 20-28L capacity
Final Source Code for Features Section HTML CSS:
HTML
<section class="features-section" aria-labelledby="features-heading">
<div class="section-container">
<div class="features-header">
<p class="section-label">The details make the difference</p>
<h2 id="features-heading">A pack that works for you.</h2>
<p class="features-description">Practical features. Nothing extra. Just what you need to make getting out the door a little easier.</p>
</div>
<div class="feature-cards-wrapper">
<div class="feature-card">
<img src="laptop-sleeve.png" alt="">
<h3>A place for everything</h3>
<p>A padded laptop sleeve, an easy-access front pocket, and room for the things you carry every day.</p>
<p class="feature-highlight">Dedicated 16″ laptop sleeve</p>
</div>
<div class="feature-card">
<img src="water-resistant.png" alt="">
<h3>Ready for a little rain</h3>
<p>Water-resistant fabric and a roll-top closure help keep your belongings dry when the weather turns.</p>
<p class="feature-highlight">Water-resistant outer fabric</p>
</div>
<div class="feature-card">
<img src="adjustable-straps.png" alt="">
<h3>Comfort that carries</h3>
<p>Cushioned shoulder straps and a breathable back panel make a full pack easier to carry.</p>
<p class="feature-highlight">Padded, adjustable straps</p>
</div>
<div class="feature-card">
<img src="flexible.png" alt="">
<h3>More room when you need it</h3>
<p>Unroll the top for a little extra space. Roll it back down when you're just taking the essentials.</p>
<p class="feature-highlight">Flexible 20-28L capacity</p>
</div>
</div>
</div>
</section>
CSS
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
:root {
--color-bg-primary: hsl(120 7% 97%);
--color-bg-secondary: hsl(0 0% 100%);
--color-text-primary: hsl(146 10% 14%);
--color-text-secondary: hsl(129 3% 40%);
--color-text-tertiary: hsl(151 14% 35%);
--color-border-primary: hsl(120 8% 88%);
}
body {
font-family: "Inter", sans-serif;
}
.features-section {
padding-block: clamp(4rem, calc(1rem + 6.67vw), 7rem);
padding-inline: 5%;
background-color: var(--color-bg-primary);
color: var(--color-text-primary);
.section-container {
max-width: 67.5rem;
margin-inline: auto;
}
.features-header {
max-width: 35rem;
.section-label {
font-weight: 500;
font-size: .875rem;
line-height: 1.4;
color: var(--color-text-tertiary);
}
h2 {
margin-block-start: 1rem;
font-weight: 600;
font-size: clamp(2rem, calc(1rem + 1.94vw), 2.75rem);
line-height: 1.15;
letter-spacing: -0.0264em;
}
.features-description {
margin-block-start: 1.25rem;
font-size: 1rem;
line-height: 1.75;
color: var(--color-text-secondary);
max-width: 30rem;
}
}
.feature-cards-wrapper {
margin-block-start: 2.75rem;
display: grid;
grid-template-columns: repeat(2, 1fr);
gap: 1.25rem;
@media (width < 600px) {
grid-template-columns: 1fr;
}
}
.feature-card {
background-color: var(--color-bg-secondary);
border: 1px solid var(--color-border-primary);
border-radius: .5rem;
padding: 2rem 2rem 1.5rem;
display: flex;
flex-direction: column;
@media (width < 600px) {
padding: 1.25rem 1.25rem 1rem;
}
img {
width: 2rem;
height: 2rem;
}
h3 {
margin-block-start: 1.75rem;
font-weight: 600;
font-size: 1.25rem;
line-height: 1.4;
letter-spacing: -0.02em;
}
p:not(.feature-highlight) {
margin-block: .75rem 1.75rem;
font-size: 1rem;
line-height: 1.6;
color: var(--color-text-secondary);
max-width: 25rem;
}
.feature-highlight {
margin-block-start: auto;
padding-block-start: 1rem;
font-size: .875rem;
line-height: 1.4;
color: var(--color-text-tertiary);
border-top: 1px solid var(--color-border-primary);
}
}
}
If you have any doubts or stuck somewhere, you can reach out through Coding Yaar's Discord server.