Episode 6 of 32
Styling the Main Content
Style the blog post cards, content grid, and sidebar with CSS — card design, typography, and two-column layout.
Styling the Main Content
Now let's style the main content area — the blog post cards, the two-column layout (content + sidebar), and the widget styling.
Section Title Styling
.section-title {
font-size: 28px;
font-weight: 700;
color: #2c3e50;
margin-bottom: 30px;
padding-bottom: 12px;
border-bottom: 3px solid #3498db;
display: inline-block;
}
Two-Column Layout
#main-content {
padding: 60px 0;
}
.content-wrapper {
display: flex;
gap: 30px;
}
.primary-content {
flex: 2;
}
.sidebar {
flex: 1;
min-width: 260px;
}
Blog Post Cards
.post-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
gap: 24px;
}
.post-card {
background: #fff;
border-radius: 8px;
overflow: hidden;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
transition: transform 0.3s ease, box-shadow 0.3s ease;
}
.post-card:hover {
transform: translateY(-4px);
box-shadow: 0 6px 20px rgba(0, 0, 0, 0.12);
}
.post-card img {
width: 100%;
height: 200px;
object-fit: cover;
}
.post-card-body {
padding: 20px;
}
.post-card-body h3 {
font-size: 18px;
margin-bottom: 8px;
}
.post-card-body h3 a {
color: #2c3e50;
transition: color 0.3s ease;
}
.post-card-body h3 a:hover {
color: #3498db;
}
.post-meta {
font-size: 13px;
color: #999;
margin-bottom: 10px;
}
.post-meta .date { margin-right: 12px; }
.post-card-body p {
font-size: 14px;
color: #666;
line-height: 1.7;
margin-bottom: 12px;
}
.read-more {
font-size: 14px;
font-weight: 600;
color: #3498db;
transition: color 0.3s ease;
}
.read-more:hover {
color: #2c3e50;
}
Sidebar / Widget Styling
.widget {
background: #fff;
padding: 24px;
border-radius: 8px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
margin-bottom: 24px;
}
.widget-title {
font-size: 18px;
font-weight: 700;
color: #2c3e50;
margin-bottom: 16px;
padding-bottom: 10px;
border-bottom: 2px solid #3498db;
}
.widget ul li {
padding: 8px 0;
border-bottom: 1px solid #eee;
}
.widget ul li:last-child {
border-bottom: none;
}
.widget ul li a {
color: #555;
font-size: 14px;
transition: color 0.3s ease, padding-left 0.3s ease;
}
.widget ul li a:hover {
color: #3498db;
padding-left: 4px;
}
/* Search Form */
.search-form {
display: flex;
}
.search-form input {
flex: 1;
padding: 10px 14px;
border: 1px solid #ddd;
border-radius: 4px 0 0 4px;
font-size: 14px;
outline: none;
}
.search-form input:focus {
border-color: #3498db;
}
.search-form button {
padding: 10px 18px;
background: #3498db;
color: #fff;
border: none;
border-radius: 0 4px 4px 0;
cursor: pointer;
font-size: 14px;
}
.search-form button:hover {
background: #2980b9;
}
The Two-Column Pattern
This content + sidebar layout is the classic WordPress blog structure:
flex: 2on content andflex: 1on sidebar creates a roughly 66%/33% splitmin-width: 260pxon the sidebar prevents it from becoming too narrow- On smaller screens, we'll stack them vertically with a media query
Key Takeaways
- Use Flexbox for the two-column layout with
flex: 2andflex: 1 - CSS Grid with
auto-fill+minmaxcreates a responsive post card grid - Card components use
overflow: hidden,box-shadow, and hover transforms - Widget styles mirror WordPress widget output — clean list-based design
- All these CSS styles will transfer directly to the WordPress theme's
style.css