
Syncfusion Angular Card
- 170 installs
- Updated August 4, 2026
- syncfusion/angular-ui-components-skills
Use syncfusion-angular-card for development tasks
About
syncfusion-angular-card: A skill for development. This provides functionality for development workflows.
- syncfusion-angular-card
Syncfusion Angular Card by the numbers
- 170 all-time installs (skills.sh)
- +11 installs in the week ending Aug 5, 2026 (Skillselion tracking)
- Ranked #2,287 of 4,347 Backend & APIs skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/syncfusion/angular-ui-components-skills --skill syncfusion-angular-cardAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 170 |
|---|---|
| Last updated | August 4, 2026 |
| Repository | syncfusion/angular-ui-components-skills ↗ |
What it does
Use syncfusion-angular-card for development tasks
Files
Implementing Syncfusion Angular Cards
The Card is a lightweight, CSS-based layout component that provides a flexible container for displaying structured content. Perfect for creating reusable content blocks with headers, images, text, and interactive elements.
When to Use This Skill
Use this skill when users need to:
- Create card-based layouts with structured content
- Add headers with titles, subtitles, and images to cards
- Include images and captions within cards
- Add interactive action buttons to cards
- Arrange card elements horizontally
- Customize card appearance with CSS
- Build flexible, responsive content containers
- Integrate other Syncfusion components within cards
Component Overview
The Syncfusion Angular Card (e-card) is a pure CSS component with no JavaScript dependencies. It provides semantic HTML structure and CSS classes that enable you to build professional card layouts with:
- Flexible Structure: Pure CSS composition with no complex dependencies
- Semantic Elements: Clear class-based architecture for headers, content, and actions
- Responsive Design: Works with CSS grid, flexbox, and responsive layouts
- Component Integration: Host other Syncfusion components inside cards
- Extensive Customization: Full CSS control over appearance and behavior
Key CSS Classes:
e-card— Root card containere-card-header— Header section wrappere-card-content— Main content areae-card-image— Image containere-card-actions— Action buttons containere-card-horizontal— Horizontal layout modee-card-separator— Visual divider between sections
---
Documentation and Navigation Guide
Getting Started
📄 Read: references/getting-started.md
- Package installation and setup
- Angular CLI and environment configuration
- Adding CSS theme imports
- Basic card structure with headers and content
- Your first working card example
Card Headers
📄 Read: references/card-headers.md
- Header structure and wrapper elements
- Adding titles and subtitles
- Including images in headers
- Image positioning (before/after caption)
- Rounded corners and image styling
- Complete header examples
Card Images
📄 Read: references/card-images.md
- Adding images to card content
- Image sizing and dimensions
- Image titles and captions with overlay
- Dividers for visual separation
- Integrating other components inside cards
- Complete image examples
Action Buttons
📄 Read: references/action-buttons.md
- Creating action buttons and links
- Horizontal button alignment (default)
- Vertical button alignment
- Icon buttons and custom styling
- Interactive card controls
- Button examples with layouts
Horizontal Layout
📄 Read: references/horizontal-layout.md
- Side-by-side element alignment
- Using the
e-card-horizontalclass - Stacked sections with
e-card-stacked - Mixed horizontal and vertical layouts
- Combining images with vertical content
- Horizontal layout examples
Styling and Customization
📄 Read: references/styling-customization.md
- CSS structure and class selectors
- Customizing card appearance
- Header, content, and button styling
- Image and divider customization
- Theme integration
- Advanced CSS patterns
---
Quick Start Example
Here's a minimal working card with header, content, and action buttons:
<!-- In your app.component.html or template -->
<div class="e-card" style="max-width: 400px;">
<!-- Header Section -->
<div class="e-card-header">
<div class="e-card-header-caption">
<div class="e-card-header-title">Card Title</div>
<div class="e-card-sub-title">Subtitle or description</div>
</div>
</div>
<!-- Content Section -->
<div class="e-card-content">
Your main content goes here. This can be text, images, or any HTML elements.
</div>
<!-- Action Buttons Section -->
<div class="e-card-actions">
<button class="e-card-btn">Action 1</button>
<button class="e-card-btn">Action 2</button>
</div>
</div>Setup in Component:
import { Component } from '@angular/core';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css'],
standalone: true
})
export class AppComponent {}Add CSS Theme to styles.css:
@import '../node_modules/@syncfusion/ej2-base/styles/material3.css';
@import '../node_modules/@syncfusion/ej2-layouts/styles/material3.css';---
Common Patterns
Pattern 1: Product Card with Image
Display a product with image, title, description, and action buttons:
<div class="e-card" style="max-width: 300px;">
<div class="e-card-image" style="background-image: url('product.jpg'); height: 200px;"></div>
<div class="e-card-header">
<div class="e-card-header-title">Product Name</div>
</div>
<div class="e-card-content">Product description here</div>
<div class="e-card-actions">
<button class="e-card-btn">Add to Cart</button>
</div>
</div>Pattern 2: User Profile Card
Display user information with avatar and social actions:
<div class="e-card" style="max-width: 350px;">
<div class="e-card-header">
<div class="e-card-header-image" style="width: 60px; height: 60px; background-image: url('avatar.jpg');"></div>
<div class="e-card-header-caption">
<div class="e-card-header-title">John Doe</div>
<div class="e-card-sub-title">Senior Developer</div>
</div>
</div>
<div class="e-card-content">Bio or description text</div>
<div class="e-card-actions">
<button class="e-card-btn">Follow</button>
<button class="e-card-btn">Message</button>
</div>
</div>Pattern 3: Horizontal Card Layout
Combine image with vertical content for compact horizontal layout:
<div class="e-card e-card-horizontal" style="max-width: 500px;">
<img src="image.jpg" alt="Image" style="height: 200px; width: 200px;">
<div class="e-card-stacked">
<div class="e-card-header">
<div class="e-card-header-title">Title</div>
</div>
<div class="e-card-content">Content description</div>
</div>
</div>---
Key Props and Classes Reference
| Class | Purpose | Usage |
|---|---|---|
e-card | Root container | Required for all cards |
e-card-header | Header wrapper | Groups title, subtitle, images |
e-card-header-caption | Header content container | Wraps titles and subtitles |
e-card-header-title | Main header title | Card headline |
e-card-sub-title | Subtitle text | Secondary header information |
e-card-header-image | Header image | Avatar or header graphic |
e-card-content | Content area | Main card body content |
e-card-image | Content image | Full-width or sized images |
e-card-title | Image overlay title | Caption over images |
e-card-separator | Visual divider | Separation between sections |
e-card-actions | Buttons container | Groups interactive elements |
e-card-btn | Action button style | Interactive button element |
e-card-vertical | Vertical alignment | Stack action buttons vertically |
e-card-horizontal | Horizontal layout | Side-by-side element arrangement |
e-card-stacked | Vertical section | Vertical area within horizontal layout |
e-card-corner | Rounded corners | Add border-radius to images |
---
Component Architecture
The Card component uses a layered CSS structure:
Card Container (e-card)
├── Header Section (e-card-header) [optional]
│ ├── Header Image (e-card-header-image) [optional]
│ └── Header Caption (e-card-header-caption)
│ ├── Header Title (e-card-header-title)
│ └── Subtitle (e-card-sub-title) [optional]
├── Image Container (e-card-image) [optional]
│ └── Image Title (e-card-title) [optional]
├── Content Section (e-card-content)
├── Separator (e-card-separator) [optional]
└── Actions Container (e-card-actions) [optional]
├── Button (e-card-btn)
└── Link ElementsLayout Modes:
- Vertical (default): All elements stack vertically
- Horizontal: Use
e-card-horizontalclass to arrange elements side-by-side - Stacked within Horizontal: Use
e-card-stackedto force vertical flow in horizontal layouts
---
Common Use Cases
1. Product Catalogs: Display products with images, descriptions, and purchase buttons 2. User Profiles: Show user information with avatars and action buttons 3. Blog Posts: Create article previews with images, excerpts, and read buttons 4. Dashboard Widgets: Build dashboard cards with data and interactive elements 5. To-Do Lists: Combine cards with ListView components for task management 6. Image Galleries: Display images with captions and metadata 7. Team Members: Show staff profiles with contact and role information 8. Feature Highlights: Showcase features with icons and descriptions
---
Next Steps
Choose your learning path based on your needs:
- New to Cards? Start with Getting Started to set up your first card
- Building Complex Headers? Read Card Headers for advanced header patterns
- Styling Your Cards? Check Styling and Customization for CSS techniques
- Creating Layouts? Explore Horizontal Layout for side-by-side arrangements
- Need Full Examples? Each reference file includes complete, copy-paste-ready code
---
Questions? Each reference file has detailed examples and edge cases. Refer to the specific topic that matches your current need.
Action Buttons in Syncfusion Angular Cards
Table of Contents
- Creating Action Buttons
- Button Container Structure
- Horizontal Alignment (Default)
- Vertical Alignment
- Icon Buttons
- Styling and Customization
- Event Handling
- Complete Button Examples
---
Creating Action Buttons
Basic Action Button
Add interactive buttons to cards with the e-card-actions container:
<div class="e-card">
<div class="e-card-header">
<div class="e-card-header-caption">
<div class="e-card-header-title">Action Example</div>
</div>
</div>
<div class="e-card-content">
Card content goes here
</div>
<div class="e-card-actions">
<button class="e-card-btn">Action 1</button>
<button class="e-card-btn">Action 2</button>
</div>
</div>Button Elements
You can use both <button> and <a> elements with the e-card-btn class:
<div class="e-card-actions">
<!-- Button element -->
<button class="e-card-btn">Submit</button>
<!-- Anchor (link) element -->
<a href="#" class="e-card-btn">Share</a>
<!-- Link with target -->
<a href="/details" class="e-card-btn" target="_blank">Learn More</a>
</div>---
Button Container Structure
e-card-actions Container
The e-card-actions div is a flexible container for action elements:
<div class="e-card-actions">
<!-- Place buttons here -->
</div>CSS Structure:
.e-card-actions {
display: flex;
gap: 8px;
padding: 12px 16px;
background-color: #f5f5f5;
border-top: 1px solid #eee;
}Button Class Styling
The e-card-btn class provides default button styling:
.e-card-btn {
flex: 1;
padding: 10px 16px;
border: 1px solid #ddd;
background-color: white;
color: #333;
font-size: 14px;
font-weight: 500;
cursor: pointer;
border-radius: 4px;
transition: all 0.2s ease;
}
.e-card-btn:hover {
background-color: #f0f0f0;
border-color: #999;
}
.e-card-btn:active {
background-color: #e0e0e0;
}---
Horizontal Alignment (Default)
Buttons are aligned horizontally by default, filling available space equally:
<div class="e-card" style="max-width: 400px;">
<div class="e-card-header-title">Eiffel Tower</div>
<div class="e-card-content">
The Eiffel Tower is acknowledged as the universal symbol of Paris and France.
</div>
<div class="e-card-actions">
<button class="e-card-btn">
<img src="./fav.png" style="height: 18px;width: 18px;" title="Bookmark">
</button>
<button class="e-card-btn">
<img src="./like.png" style="height: 18px;width: 18px;" title="Like">
</button>
<button class="e-card-btn">
<img src="./share.png" style="height: 18px;width: 18px;" title="Share">
</button>
</div>
</div>CSS for Horizontal Layout
.e-card-actions {
display: flex;
flex-direction: row;
gap: 8px;
}
.e-card-btn {
flex: 1;
/* Buttons share equal width */
}Variable Width Buttons
Let buttons size to their content:
.e-card-btn {
flex: none;
padding: 10px 16px;
}<div class="e-card-actions">
<button class="e-card-btn">Short</button>
<button class="e-card-btn">Save Changes</button>
<button class="e-card-btn">X</button>
</div>---
Vertical Alignment
Stack buttons vertically by adding the e-card-vertical class:
<div class="e-card" style="max-width: 400px;">
<div class="e-card-header-title">Eiffel Tower</div>
<div class="e-card-content">
The Eiffel Tower is acknowledged as the universal symbol of Paris and France.
</div>
<div class="e-card-actions e-card-vertical">
<button class="e-card-btn">LIKE</button>
<button class="e-card-btn">SHARE</button>
</div>
</div>CSS for Vertical Layout
.e-card-actions.e-card-vertical {
flex-direction: column;
gap: 8px;
}
.e-card-actions.e-card-vertical .e-card-btn {
width: 100%;
}Vertical with Icon Buttons
<div class="e-card-actions e-card-vertical">
<button class="e-card-btn icon-btn">
<i class="icon-heart"></i> Like
</button>
<button class="e-card-btn icon-btn">
<i class="icon-share"></i> Share
</button>
<button class="e-card-btn icon-btn">
<i class="icon-bookmark"></i> Save
</button>
</div>---
Icon Buttons
Image Icon Buttons
Use images as button icons (from utils example):
<div class="e-card-actions">
<button class="e-card-btn">
<img src="./fav.png" style="height: 18px;width: 18px;" title="Bookmark">
</button>
<button class="e-card-btn">
<img src="./like.png" style="height: 18px;width: 18px;" title="Like">
</button>
<button class="e-card-btn">
<img src="./share.png" style="height: 18px;width: 18px;" title="Share">
</button>
</div>Icon with Text
<div class="e-card-actions">
<button class="e-card-btn">
<span style="display: flex; align-items: center; justify-content: center; gap: 6px;">
<img src="./icon.png" style="height: 16px; width: 16px;">
Action
</span>
</button>
</div>SVG Icons
<div class="e-card-actions">
<button class="e-card-btn">
<svg width="18" height="18" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<path d="M20.84 4.61a5.5 5.5 0 0 0-7.78 0L12 5.67l-1.06-1.06a5.5 5.5 0 0 0-7.78 7.78l1.06 1.06L12 21.23l7.78-7.78 1.06-1.06a5.5 5.5 0 0 0 0-7.78z"></path>
</svg>
</button>
</div>---
Styling and Customization
Primary Button Style
.e-card-btn.btn-primary {
background-color: #007bff;
color: white;
border-color: #007bff;
}
.e-card-btn.btn-primary:hover {
background-color: #0056b3;
border-color: #0056b3;
}<button class="e-card-btn btn-primary">Primary Action</button>Success Button Style
.e-card-btn.btn-success {
background-color: #28a745;
color: white;
border-color: #28a745;
}
.e-card-btn.btn-success:hover {
background-color: #1e7e34;
border-color: #1e7e34;
}Danger Button Style
.e-card-btn.btn-danger {
background-color: #dc3545;
color: white;
border-color: #dc3545;
}
.e-card-btn.btn-danger:hover {
background-color: #c82333;
border-color: #c82333;
}Outline Button Style
.e-card-btn.btn-outline {
background-color: transparent;
color: #007bff;
border: 2px solid #007bff;
}
.e-card-btn.btn-outline:hover {
background-color: #007bff;
color: white;
}Disabled Button
.e-card-btn:disabled,
.e-card-btn[disabled] {
opacity: 0.5;
cursor: not-allowed;
background-color: #e0e0e0;
}
.e-card-btn:disabled:hover {
background-color: #e0e0e0;
}<button class="e-card-btn" disabled>Disabled</button>Button Sizes
/* Small button */
.e-card-btn.btn-sm {
padding: 6px 12px;
font-size: 12px;
}
/* Large button */
.e-card-btn.btn-lg {
padding: 14px 20px;
font-size: 16px;
}Rounded Buttons
.e-card-btn.btn-rounded {
border-radius: 24px;
}
/* Fully rounded (pill shape) */
.e-card-btn.btn-pill {
border-radius: 50px;
padding: 10px 20px;
}---
Event Handling
Click Events
// card-with-buttons.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-card-with-buttons',
standalone: true,
template: `
<div class="e-card" style="max-width: 400px;">
<div class="e-card-header">
<div class="e-card-header-caption">
<div class="e-card-header-title">Interactive Card</div>
</div>
</div>
<div class="e-card-content">
{{ message }}
</div>
<div class="e-card-actions">
<button class="e-card-btn" (click)="onSave()">Save</button>
<button class="e-card-btn" (click)="onCancel()">Cancel</button>
</div>
</div>
`
})
export class CardWithButtonsComponent {
message = 'Click a button to see the message';
onSave() {
this.message = '✓ Changes saved successfully!';
}
onCancel() {
this.message = 'Action cancelled';
}
}Button State Management
// card-with-state.component.ts
import { Component } from '@angular/core';
import { CommonModule } from '@angular/common';
@Component({
selector: 'app-card-with-state',
standalone: true,
imports: [CommonModule],
template: `
<div class="e-card" style="max-width: 400px;">
<div class="e-card-header">
<div class="e-card-header-caption">
<div class="e-card-header-title">{{ title }}</div>
</div>
</div>
<div class="e-card-content">
{{ isLiked ? '❤️ You liked this' : '🤍 Like this card' }}
</div>
<div class="e-card-actions">
<button class="e-card-btn"
[class.btn-active]="isLiked"
(click)="toggleLike()">
{{ isLiked ? 'Unlike' : 'Like' }}
</button>
<button class="e-card-btn" (click)="onShare()">Share</button>
</div>
</div>
`,
styles: [`
.e-card-btn.btn-active {
background-color: #ff1744;
color: white;
border-color: #ff1744;
}
`]
})
export class CardWithStateComponent {
title = 'Interactive Card';
isLiked = false;
toggleLike() {
this.isLiked = !this.isLiked;
}
onShare() {
console.log('Share clicked');
}
}---
Complete Button Examples
Example 1: Horizontal Action Buttons (from utils)
// horizontal-buttons.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-horizontal-buttons',
standalone: true,
template: `
<div style="margin: 50px;">
<div class="e-card" style="max-width:400px">
<div class="e-card-header-title">Eiffel Tower</div>
<div class="e-card-content">
The Eiffel Tower is acknowledged as the universal symbol of Paris and France.
</div>
<div class="e-card-actions">
<button class="e-card-btn">
<img src="./fav.png" style="height: 18px;width: 18px;" title="Bookmark">
</button>
<button class="e-card-btn">
<img src="./like.png" style="height: 18px;width: 18px;" title="Like">
</button>
<button class="e-card-btn">
<img src="./share.png" style="height: 18px;width: 18px;" title="Share">
</button>
</div>
</div>
</div>
<div style="margin-left: 50px;">
<div class="e-card" style="max-width:400px">
<div class="e-card-header-title">Eiffel Tower</div>
<div class="e-card-content">
The Eiffel Tower is acknowledged as the universal symbol of Paris and France.
</div>
<div class="e-card-actions e-card-vertical">
<button class="e-card-btn">LIKE</button>
<button class="e-card-btn">SHARE</button>
</div>
</div>
</div>
`
})
export class HorizontalButtonsComponent {}Example 2: Mixed Button Types
// mixed-buttons.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-mixed-buttons',
standalone: true,
template: `
<div class="e-card" style="max-width: 500px;">
<div class="e-card-header">
<div class="e-card-header-caption">
<div class="e-card-header-title">Complete Card</div>
<div class="e-card-sub-title">With various button styles</div>
</div>
</div>
<div class="e-card-content">
This card demonstrates different button combinations and styles for various use cases.
</div>
<div class="e-card-actions">
<button class="e-card-btn btn-primary">Primary</button>
<button class="e-card-btn btn-outline">Outline</button>
</div>
</div>
`,
styles: [`
.btn-primary {
background-color: #007bff;
color: white;
border-color: #007bff;
}
.btn-primary:hover {
background-color: #0056b3;
}
.btn-outline {
background-color: transparent;
color: #007bff;
border: 2px solid #007bff;
}
.btn-outline:hover {
background-color: #007bff;
color: white;
}
`]
})
export class MixedButtonsComponent {}Example 3: Vertical Action Buttons
// vertical-buttons.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-vertical-buttons',
standalone: true,
template: `
<div style="margin: 50px;">
<div class="e-card" style="max-width:400px">
<div class="e-card-header-title">Eiffel Tower</div>
<div class="e-card-content">
The Eiffel Tower is acknowledged as the universal symbol of Paris and France.
</div>
<div class="e-card-actions e-card-vertical">
<button class="e-card-btn">LIKE</button>
<button class="e-card-btn">SHARE</button>
</div>
</div>
</div>
`
})
export class VerticalButtonsComponent {}Example 4: Responsive Button Layout
// responsive-buttons.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-responsive-buttons',
standalone: true,
template: `
<div class="e-card">
<div class="e-card-header">
<div class="e-card-header-caption">
<div class="e-card-header-title">Responsive Actions</div>
</div>
</div>
<div class="e-card-content">
Action buttons that adapt to screen size
</div>
<div class="e-card-actions" [class.vertical]="isMobileView">
<button class="e-card-btn">Action 1</button>
<button class="e-card-btn">Action 2</button>
</div>
</div>
`,
styles: [`
.e-card-actions {
display: flex;
flex-direction: row;
gap: 8px;
}
.e-card-actions.vertical {
flex-direction: column;
}
.e-card-actions.vertical .e-card-btn {
width: 100%;
}
@media (max-width: 600px) {
.e-card-actions {
flex-direction: column;
}
.e-card-btn {
width: 100%;
}
}
`]
})
export class ResponsiveButtonsComponent {
isMobileView = false;
constructor() {
this.checkScreenSize();
window.addEventListener('resize', () => this.checkScreenSize());
}
checkScreenSize() {
this.isMobileView = window.innerWidth < 600;
}
}---
Common Patterns
Pattern: Like/Favorite Toggle
<div class="e-card-actions">
<button class="e-card-btn" (click)="toggleFavorite()">
{{ isFavorite ? '❤️ Favorite' : '🤍 Add to Favorites' }}
</button>
</div>Pattern: Primary + Secondary Actions
<div class="e-card-actions">
<button class="e-card-btn btn-secondary">Cancel</button>
<button class="e-card-btn btn-primary">Save</button>
</div>Pattern: Single Full-Width Action
<div class="e-card-actions">
<button class="e-card-btn" style="flex: 1; width: 100%;">Full Width Action</button>
</div>---
Troubleshooting
Issue: Buttons not displaying in a row
- Check:
flex-direction: rowis set - Verify: Container has
display: flex
Issue: Buttons have different widths
- Check: All buttons have
flex: 1orflex: none - Ensure: Padding is consistent
Issue: Text is cut off in buttons
- Solution: Remove
flex: 1and useflex: nonefor variable width - Or: Increase button padding and height
---
Next: Arrange cards horizontally in Horizontal Layout reference.
Card Headers in Syncfusion Angular Cards
Table of Contents
- Header Structure
- Header Elements and Classes
- Titles and Subtitles
- Header Images
- Image Positioning
- Rounded Corners
- Complete Header Examples
---
Header Structure
The Card header provides a semantic section for displaying contextual information like titles, subtitles, and avatars. Headers are entirely optional but commonly used for:
- Display Headlines: Main and secondary text
- User Avatars: Profile pictures or icons
- Metadata: Author, date, category labels
- Visual Hierarchy: Distinguish cards with varied header content
Basic Header Container
<div class="e-card">
<div class="e-card-header">
<!-- Header content goes here -->
</div>
<div class="e-card-content">
<!-- Main content -->
</div>
</div>The e-card-header is a flexible container that can hold text and images in various arrangements.
---
Header Elements and Classes
CSS Classes for Headers
| Class | Purpose | Required |
|---|---|---|
e-card-header | Header container | Yes, for headers |
e-card-header-caption | Text wrapper | Groups titles and subtitles |
e-card-header-title | Main headline | Primary header text |
e-card-sub-title | Secondary text | Supporting information |
e-card-header-image | Image container | Avatar or header graphic |
e-card-corner | Rounded image | Adds border-radius to images |
Semantic Structure
<div class="e-card-header"> <!-- Header wrapper -->
<div class="e-card-header-image"></div> <!-- Image (optional, position 1) -->
<div class="e-card-header-caption"> <!-- Text wrapper -->
<div class="e-card-header-title"></div> <!-- Main title -->
<div class="e-card-sub-title"></div> <!-- Subtitle (optional) -->
</div>
<!-- Image can also be positioned here for right-aligned layout -->
</div>---
Titles and Subtitles
Title Only
The simplest header with just a title:
<div class="e-card-header">
<div class="e-card-header-caption">
<div class="e-card-header-title">Card Title</div>
</div>
</div>Title and Subtitle
Add supporting text below the title:
<div class="e-card-header">
<div class="e-card-header-caption">
<div class="e-card-header-title">Main Title</div>
<div class="e-card-sub-title">Supporting subtitle text</div>
</div>
</div>Multiple Subtitles (via CSS)
Stack multiple subtitle-style lines using nested elements:
<div class="e-card-header">
<div class="e-card-header-caption">
<div class="e-card-header-title">John Doe</div>
<div class="e-card-sub-title">Senior Developer</div>
<div class="e-card-sub-title">Technology Lead</div>
</div>
</div>CSS for spacing multiple subtitles:
.e-card-header .e-card-sub-title {
margin-top: 4px;
font-size: 12px;
color: #999;
}
.e-card-header .e-card-sub-title + .e-card-sub-title {
margin-top: 2px;
}---
Header Images
Basic Header Image
Add an image in the header (typically a small avatar):
<div class="e-card-header">
<div class="e-card-header-image"
style="width: 48px; height: 48px;
background-image: url('avatar.jpg');
background-size: cover;">
</div>
<div class="e-card-header-caption">
<div class="e-card-header-title">User Name</div>
</div>
</div>Image with Caption
Position image before or after the caption:
Image Before Caption (Left-aligned):
<div class="e-card-header">
<div class="e-card-header-image"
style="width: 60px; height: 60px;
background-image: url('profile.jpg');
background-size: cover;
margin-right: 12px;">
</div>
<div class="e-card-header-caption">
<div class="e-card-header-title">Laura Callahan</div>
<div class="e-card-sub-title">Sales Coordinator</div>
</div>
</div>Image After Caption (Right-aligned):
<div class="e-card-header">
<div class="e-card-header-caption">
<div class="e-card-header-title">Laura Callahan</div>
<div class="e-card-sub-title">Sales Coordinator</div>
</div>
<div class="e-card-header-image"
style="width: 60px; height: 60px;
background-image: url('profile.jpg');
background-size: cover;
margin-left: auto;">
</div>
</div>---
Image Positioning
Left-Aligned Image (Default)
Image appears to the left of text:
<div class="e-card-header">
<div class="e-card-header-image football e-card-corner"
style="width: 48px; height: 48px;">
</div>
<div class="e-card-header-caption">
<div class="e-card-header-title">Laura Callahan</div>
<div class="e-card-sub-title">Sales Coordinator and Representative</div>
</div>
</div>CSS for left-aligned layout:
.e-card-header {
display: flex;
align-items: center;
gap: 12px;
}
.e-card-header-image {
flex-shrink: 0;
}
.e-card-header-caption {
flex: 1;
}Right-Aligned Image
Image appears to the right of text:
<div class="e-card-header">
<div class="e-card-header-caption">
<div class="e-card-header-title">Laura Callahan</div>
<div class="e-card-sub-title">Sales Coordinator</div>
</div>
<div class="e-card-header-image football e-card-corner"
style="width: 48px; height: 48px; margin-left: auto;">
</div>
</div>CSS for right-aligned layout:
.e-card-header {
display: flex;
align-items: center;
gap: 12px;
}
.e-card-header-image {
flex-shrink: 0;
margin-left: auto;
}
.e-card-header-caption {
flex: 1;
}Centered Header Image
Center an image above the text (vertical layout):
<div class="e-card-header" style="flex-direction: column; align-items: center; text-align: center;">
<div class="e-card-header-image"
style="width: 80px; height: 80px;
background-image: url('avatar.jpg');
background-size: cover;
border-radius: 50%;
margin-bottom: 12px;">
</div>
<div class="e-card-header-caption">
<div class="e-card-header-title">Jane Smith</div>
<div class="e-card-sub-title">Product Manager</div>
</div>
</div>---
Rounded Corners
Using e-card-corner Class
Add the e-card-corner class to images for rounded corners:
<div class="e-card-header-image e-card-corner"
style="width: 48px; height: 48px; background-image: url('avatar.jpg');
background-size: cover;">
</div>CSS for Rounded Corners
The e-card-corner class applies border-radius: 4px. For circular images:
<div class="e-card-header-image"
style="width: 48px; height: 48px;
background-image: url('avatar.jpg');
background-size: cover;
border-radius: 50%;">
</div>Customizing Border Radius
/* Slight rounding (default) */
.e-card-header-image.e-card-corner {
border-radius: 4px;
}
/* Fully rounded (circular) */
.e-card-header-image.rounded-circle {
border-radius: 50%;
}
/* More rounded */
.e-card-header-image.rounded-lg {
border-radius: 12px;
}---
Complete Header Examples
Example 1: Product Card Header
// app.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-product-card',
standalone: true,
template: `
<div class="e-card" style="max-width: 300px;">
<div class="e-card-header">
<div class="e-card-header-image"
style="width: 80px; height: 80px;
background-image: url('product.jpg');
background-size: cover;
margin-right: 12px;">
</div>
<div class="e-card-header-caption">
<div class="e-card-header-title">Premium Widget</div>
<div class="e-card-sub-title">Category: Electronics</div>
</div>
</div>
<div class="e-card-content">
High-quality widget with premium features and durability.
</div>
</div>
`
})
export class ProductCardComponent {}Example 2: User Profile Header
// user-card.component.ts
import { Component } from '@angular/core';
interface User {
name: string;
title: string;
department: string;
avatar: string;
}
@Component({
selector: 'app-user-card',
standalone: true,
template: `
<div class="e-card" style="max-width: 350px;">
<div class="e-card-header user-header">
<div class="e-card-header-image user-avatar"
[style.background-image]="'url(' + user.avatar + ')'">
</div>
<div class="e-card-header-caption">
<div class="e-card-header-title">{{ user.name }}</div>
<div class="e-card-sub-title">{{ user.title }}</div>
<div class="e-card-sub-title">{{ user.department }}</div>
</div>
</div>
<div class="e-card-content">
Senior team member with expertise in multiple domains.
</div>
</div>
`,
styles: [`
.user-header {
display: flex;
align-items: center;
gap: 16px;
}
.user-avatar {
width: 60px;
height: 60px;
flex-shrink: 0;
background-size: cover;
border-radius: 50%;
}
`]
})
export class UserCardComponent {
user: User = {
name: 'John Doe',
title: 'Senior Developer',
department: 'Engineering',
avatar: 'assets/john.jpg'
};
}Example 3: Article/Blog Header
// blog-card.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-blog-card',
standalone: true,
template: `
<div class="e-card" style="max-width: 400px;">
<div class="e-card-header article-header">
<div class="e-card-header-caption">
<div class="e-card-header-title">Angular Best Practices</div>
<div class="e-card-sub-title">By Sarah Johnson</div>
<div class="article-meta">March 27, 2026 • 8 min read</div>
</div>
</div>
<div class="e-card-content">
Learn essential patterns and techniques for building scalable Angular applications...
</div>
<div class="e-card-actions">
<button class="e-card-btn">Read More</button>
</div>
</div>
`,
styles: [`
.article-header {
padding: 16px;
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
}
.e-card-header-title {
color: white !important;
font-size: 20px;
font-weight: 600;
}
.e-card-sub-title {
color: rgba(255, 255, 255, 0.9) !important;
}
.article-meta {
font-size: 12px;
color: rgba(255, 255, 255, 0.7);
margin-top: 8px;
}
`]
})
export class BlogCardComponent {}Example 4: Multiple Cards with Headers
This example demonstrates the complete code snippet from utils (card-header-cs1):
// cards-grid.component.ts
import { Component } from '@angular/core';
import { CommonModule } from '@angular/common';
interface CardData {
title: string;
subtitle: string;
content: string;
avatar: string;
}
@Component({
selector: 'app-cards-grid',
standalone: true,
imports: [CommonModule],
template: `
<div style="margin: 50px;">
<div tabindex="0" class="e-card" *ngFor="let card of cards">
<div class="e-card-header">
<div class="e-card-header-image football e-card-corner"></div>
<div class="e-card-header-caption">
<div class="e-card-header-title">{{ card.title }}</div>
<div class="e-card-sub-title">{{ card.subtitle }}</div>
</div>
</div>
<div class="e-card-content">
{{ card.content }}
</div>
</div>
</div>
`,
styles: [`
.e-card {
margin-bottom: 20px;
max-width: 500px;
}
`]
})
export class CardsGridComponent {
cards: CardData[] = [
{
title: 'Laura Callahan',
subtitle: 'Sales Coordinator and Representative',
content: 'Laura received a BA in psychology from the University of Washington. She has also completed a course in business French.',
avatar: 'assets/laura.jpg'
},
{
title: 'Michael King',
subtitle: 'Project Manager',
content: 'Michael leads cross-functional teams to deliver complex projects on time and within budget.',
avatar: 'assets/michael.jpg'
},
{
title: 'Emily Johnson',
subtitle: 'UI/UX Designer',
content: 'Emily specializes in creating intuitive and beautiful user interfaces for modern web applications.',
avatar: 'assets/emily.jpg'
}
];
}---
Common Header Patterns
Pattern: Compact Header with Avatar
Minimal header with small avatar and text:
<div class="e-card-header" style="display: flex; align-items: center; gap: 8px;">
<div class="e-card-header-image"
style="width: 36px; height: 36px;
background-image: url('avatar.jpg');
background-size: cover;
border-radius: 50%;
flex-shrink: 0;">
</div>
<div class="e-card-header-caption">
<div class="e-card-header-title" style="font-size: 14px;">User Name</div>
</div>
</div>Pattern: Large Header Image
Full-width header image with overlay text:
<div class="e-card-header" style="position: relative; padding: 0;">
<div style="background-image: url('banner.jpg');
background-size: cover;
background-position: center;
height: 200px;
position: relative;">
<div style="position: absolute; bottom: 0; left: 0; right: 0;
background: linear-gradient(to top, rgba(0,0,0,0.6), transparent);
padding: 20px;
color: white;">
<div style="font-size: 20px; font-weight: 600;">Header Title</div>
<div style="font-size: 14px; opacity: 0.9;">Subtitle text</div>
</div>
</div>
</div>Pattern: Status Badge Header
Header with title and status indicator:
<div class="e-card-header" style="display: flex; align-items: center; justify-content: space-between;">
<div class="e-card-header-caption">
<div class="e-card-header-title">Task Name</div>
<div class="e-card-sub-title">Assigned to John Doe</div>
</div>
<span style="background: #4CAF50; color: white;
padding: 4px 12px; border-radius: 20px;
font-size: 12px; font-weight: 500;">
Active
</span>
</div>---
Styling Tips
Make headers stand out:
.e-card-header {
background-color: #f8f9fa;
border-bottom: 1px solid #eee;
}
.e-card-header-title {
font-weight: 600;
color: #333;
}
.e-card-header-image {
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}Hover effects:
.e-card:hover .e-card-header-title {
color: #007bff;
transition: color 0.2s ease;
}---
Edge Cases
Missing Avatar: Provide fallback styling:
.e-card-header-image {
background-color: #e0e0e0;
background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="white" stroke-width="2"><path d="M20 21v-2a4 4 0 0 0-4-4H8a4 4 0 0 0-4 4v2"/><circle cx="12" cy="7" r="4"/></svg>');
background-repeat: no-repeat;
background-position: center;
background-size: 50%;
}Long Text: Use text truncation:
.e-card-header-title {
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
}---
Next: Learn about images in card content in Card Images reference.
Card Images in Syncfusion Angular Cards
Table of Contents
- Adding Images to Cards
- Image Sizing and Dimensions
- Image Titles and Captions
- Dividers for Visual Separation
- Image Styling Techniques
- Integrating Other Components
- Complete Image Examples
---
Adding Images to Cards
Basic Image Container
Add images to card content using the e-card-image class:
<div class="e-card">
<div class="e-card-image"></div>
<div class="e-card-content">
Content below the image
</div>
</div>By default, e-card-image occupies the full width of the card. Use CSS to set the background image:
<div class="e-card">
<div class="e-card-image"
style="background-image: url('hero-image.jpg');
background-size: cover;
background-position: center;
height: 250px;">
</div>
<div class="e-card-content">
Content positioned below the image
</div>
</div>Image Placement
Image at Top (default):
<div class="e-card">
<div class="e-card-image" style="height: 200px; background-image: url('top.jpg'); background-size: cover;"></div>
<div class="e-card-header">
<div class="e-card-header-caption">
<div class="e-card-header-title">Title</div>
</div>
</div>
<div class="e-card-content">Content</div>
</div>Image with Header:
<div class="e-card">
<div class="e-card-header">
<div class="e-card-header-caption">
<div class="e-card-header-title">Title</div>
</div>
</div>
<div class="e-card-image" style="height: 250px; background-image: url('image.jpg'); background-size: cover;"></div>
<div class="e-card-content">Content</div>
</div>Responsive Images
Make images responsive with max-width:
.e-card-image {
width: 100%;
height: 250px;
background-size: cover;
background-position: center;
}
@media (max-width: 600px) {
.e-card-image {
height: 180px;
}
}---
Image Sizing and Dimensions
Fixed Height Images
<div class="e-card-image"
style="height: 250px;
background-image: url('image.jpg');
background-size: cover;
background-position: center;">
</div>Aspect Ratio Preserved
Use padding-bottom trick for consistent aspect ratios:
.e-card-image {
background-size: cover;
background-position: center;
width: 100%;
padding-bottom: 75%; /* 4:3 aspect ratio */
height: 0;
}Square Images
.e-card-image {
width: 100%;
aspect-ratio: 1 / 1;
background-size: cover;
background-position: center;
}Custom Dimensions
<!-- Small thumbnail -->
<div class="e-card-image"
style="height: 120px; width: 120px;">
</div>
<!-- Wide banner -->
<div class="e-card-image"
style="height: 300px; width: 100%;">
</div>
<!-- Full width tall image -->
<div class="e-card-image"
style="height: 400px; width: 100%;">
</div>---
Image Titles and Captions
Basic Image Title
Add a title overlay on the image:
<div class="e-card-image"
style="background-image: url('image.jpg');
background-size: cover;
background-position: center;
height: 250px;
position: relative;">
<div class="e-card-title">Image Caption</div>
</div>Default Positioning
By default, e-card-title is positioned in the bottom-left with an overlay effect:
.e-card-image .e-card-title {
position: absolute;
bottom: 0;
left: 0;
right: 0;
background: linear-gradient(to top, rgba(0,0,0,0.6), transparent);
color: white;
padding: 12px 16px;
font-size: 16px;
font-weight: 500;
}Custom Title Positioning
Top-Left:
<div class="e-card-image" style="position: relative; height: 250px; background-image: url('image.jpg'); background-size: cover;">
<div class="e-card-title e-card-top-left">Top Left Title</div>
</div>.e-card-image .e-card-title.e-card-top-left {
top: 0;
bottom: auto;
background: linear-gradient(to bottom, rgba(0,0,0,0.6), transparent);
}Top-Right:
<div class="e-card-image" style="position: relative; height: 250px; background-image: url('image.jpg'); background-size: cover;">
<div class="e-card-title e-card-top-right">Top Right</div>
</div>.e-card-image .e-card-title.e-card-top-right {
top: 0;
bottom: auto;
left: auto;
right: 0;
text-align: right;
background: linear-gradient(to bottom, rgba(0,0,0,0.6), transparent);
}Bottom-Right:
<div class="e-card-image" style="position: relative; height: 250px; background-image: url('image.jpg'); background-size: cover;">
<div class="e-card-title e-card-bottom-right">Bottom Right</div>
</div>.e-card-image .e-card-title.e-card-bottom-right {
right: 0;
left: auto;
text-align: right;
background: linear-gradient(to top, rgba(0,0,0,0.6), transparent);
}Complete Image Example
// image-card.component.ts
import { Component } from '@angular/core';
import { CommonModule } from '@angular/common';
@Component({
selector: 'app-image-card',
standalone: true,
imports: [CommonModule],
template: `
<div class="e-card" style="max-width: 400px;">
<div class="e-card-image">
<div class="e-card-title">JavaScript</div>
</div>
<div class="e-card-content">
JavaScript Succinctly was written to give readers an accurate, concise examination of JavaScript objects and their supporting nuances, such as complex values, primitive values, scope, inheritance, the head object, and more.
</div>
</div>
`,
styles: [`
.e-card-image {
background-image: url('assets/js-book.jpg');
background-size: cover;
background-position: center;
height: 200px;
position: relative;
}
.e-card-title {
position: absolute;
bottom: 0;
left: 0;
right: 0;
background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
color: white;
padding: 16px;
font-size: 18px;
font-weight: 600;
}
`]
})
export class ImageCardComponent {}---
Dividers for Visual Separation
Basic Divider
Add visual separation between card sections:
<div class="e-card">
<div class="e-card-title">Explore Cities</div>
<div class="e-card-separator"></div>
<div class="e-card-content">
Sydney is a city on the east coast of Australia.
</div>
<div class="e-card-separator"></div>
<div class="e-card-content">
New York City has been described as the cultural, financial, and media capital of the world.
</div>
<div class="e-card-separator"></div>
<div class="e-card-content">
Malaysia is one of the Southeast Asian countries.
</div>
</div>Divider Styling
Default divider appearance:
.e-card-separator {
height: 1px;
background-color: #ddd;
margin: 16px 0;
}Custom Divider Styles
Thick Divider:
.e-card-separator {
height: 2px;
background-color: #999;
}Colored Divider:
.e-card-separator {
height: 2px;
background: linear-gradient(to right, #667eea, #764ba2);
}Dashed Divider:
.e-card-separator {
height: 1px;
border-top: 1px dashed #ccc;
background: none;
}Reduced Spacing:
.e-card-separator {
margin: 8px 0;
padding-bottom: 30px;
}Multiple Sections with Dividers
<div class="e-card">
<div class="e-card-title">Multi-Section Card</div>
<div class="e-card-separator"></div>
<div class="e-card-content">
<strong>Section 1</strong>
<p>First section content</p>
</div>
<div class="e-card-separator"></div>
<div class="e-card-content">
<strong>Section 2</strong>
<p>Second section content</p>
</div>
<div class="e-card-separator"></div>
<div class="e-card-actions">
<button class="e-card-btn">Action</button>
</div>
</div>---
Image Styling Techniques
Image Filters
Apply effects to images:
.e-card-image {
background-image: url('image.jpg');
background-size: cover;
height: 250px;
filter: brightness(0.8) contrast(1.2);
}
/* Hover effect */
.e-card:hover .e-card-image {
filter: brightness(1) contrast(1);
}Image Gradient Overlay
Add gradient over images for better text contrast:
<div class="e-card-image"
style="background-image: url('image.jpg');
background-size: cover;
height: 250px;
position: relative;">
<div style="position: absolute;
top: 0; left: 0; right: 0; bottom: 0;
background: linear-gradient(135deg,
rgba(102, 126, 234, 0.4),
rgba(118, 75, 162, 0.4));">
</div>
<div class="e-card-title" style="position: relative; z-index: 1;">Title</div>
</div>Border and Shadow Effects
.e-card-image {
border: 3px solid #ddd;
border-radius: 8px;
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}
.e-card:hover .e-card-image {
box-shadow: 0 8px 20px rgba(0, 0, 0, 0.25);
}---
Integrating Other Components
Integrating ListView Components
Combine cards with Syncfusion components like ListView:
// card-with-list.component.ts
import { Component, ViewChild, ElementRef, AfterViewInit } from '@angular/core';
import { ListView } from '@syncfusion/ej2-lists';
@Component({
selector: 'app-card-with-list',
standalone: true,
template: `
<div style="margin: 50px;">
<div tabindex="0" class="e-card" id="basic">
<div class="e-card-title">To-Do List</div>
<div class="e-card-separator"></div>
<div class="e-card-content">
<div #listContainer id="element"></div>
</div>
</div>
</div>
`,
styles: [`
.e-card {
max-width: 400px;
}
`]
})
export class CardWithListComponent implements AfterViewInit {
@ViewChild('listContainer') listContainer!: ElementRef;
ngAfterViewInit() {
// Define array of objects
const todoList: { [key: string]: Object }[] = [
{ todoList: 'Pay Bills' },
{ todoList: 'Call Chris' },
{ todoList: 'Meet Andrew' },
{ todoList: 'Visit Manager' },
{ todoList: 'Customer Meeting' }
];
// Initialize ListView component
const listviewInstance: ListView = new ListView({
dataSource: todoList,
fields: { text: 'todoList' },
showCheckBox: true
});
// Render initialized ListView
listviewInstance.appendTo('#element');
}
}Integrating with Charts or Other Components
<div class="e-card">
<div class="e-card-header">
<div class="e-card-header-title">Sales Analytics</div>
</div>
<div class="e-card-content">
<!-- Chart component would go here -->
<app-sales-chart></app-sales-chart>
</div>
</div>---
Complete Image Examples
Example 1: Simple Image Card
// simple-image-card.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-simple-image-card',
standalone: true,
template: `
<div class="e-card" style="max-width: 300px;">
<div class="e-card-image">
<div class="e-card-title">JavaScript</div>
</div>
<div class="e-card-content">
JavaScript Succinctly was written to give readers an accurate, concise examination of JavaScript objects and their supporting nuances.
</div>
</div>
`,
styles: [`
.e-card-image {
background-image: url('assets/javascript-book.jpg');
background-size: cover;
background-position: center;
height: 200px;
position: relative;
}
.e-card-title {
position: absolute;
bottom: 0;
left: 0;
right: 0;
background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
color: white;
padding: 16px;
font-size: 18px;
font-weight: 600;
}
`]
})
export class SimpleImageCardComponent {}Example 2: Card with Multiple Dividers (from utils)
// cards-grid-dividers.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-cards-grid-dividers',
standalone: true,
template: `
<div tabindex="0" class="e-card" id="basic">
<div class="e-card-title">Explore Cities</div>
<div class="e-card-separator"></div>
<div class="e-card-content">
Sydney is a city on the east coast of Australia. Sydney is the capital city of New South Wales. About four million people
live in Sydney which makes it the biggest city in Oceania.
</div>
<div class="e-card-separator"></div>
<div class="e-card-content">
New York City has been described as the cultural, financial, and media capital of the world, and exerts a significant impact
upon commerce and etc.,
</div>
<div class="e-card-separator"></div>
<div class="e-card-content">
Malaysia is one of the Southeast Asian countries, on a peninsula of the Asian continent, to a certain extent; it can be recognized
as part of the Asian continent.
</div>
</div>
`,
styles: [`
.e-card {
max-width: 600px;
}
`]
})
export class CardsGridDividersComponent {}Example 3: Responsive Image Grid
// image-gallery-cards.component.ts
import { Component } from '@angular/core';
import { CommonModule } from '@angular/common';
interface CardItem {
id: number;
image: string;
title: string;
description: string;
}
@Component({
selector: 'app-image-gallery-cards',
standalone: true,
imports: [CommonModule],
template: `
<div class="gallery-container">
<div class="e-card" *ngFor="let item of items">
<div class="e-card-image" [style.background-image]="'url(' + item.image + ')'">
<div class="e-card-title">{{ item.title }}</div>
</div>
<div class="e-card-content">
{{ item.description }}
</div>
</div>
</div>
`,
styles: [`
.gallery-container {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
gap: 24px;
padding: 20px;
}
.e-card-image {
height: 200px;
background-size: cover;
background-position: center;
position: relative;
}
.e-card-title {
position: absolute;
bottom: 0;
left: 0;
right: 0;
background: linear-gradient(to top, rgba(0,0,0,0.7), transparent);
color: white;
padding: 16px;
font-weight: 600;
}
.e-card:hover {
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
transform: translateY(-4px);
transition: all 0.3s ease;
}
`]
})
export class ImageGalleryCardsComponent {
items: CardItem[] = [
{
id: 1,
image: 'assets/city1.jpg',
title: 'Sydney Opera House',
description: 'Iconic architectural landmark in Sydney, Australia'
},
{
id: 2,
image: 'assets/city2.jpg',
title: 'New York Skyline',
description: 'The Manhattan skyline featuring world-famous skyscrapers'
},
{
id: 3,
image: 'assets/city3.jpg',
title: 'Malaysian Landscape',
description: 'Tropical beauty of Southeast Asia'
}
];
}---
Common Patterns
Pattern: Image with Content Below
Perfect for blogs, product listings, or galleries:
<div class="e-card">
<div class="e-card-image" style="height: 240px; background-image: url('item.jpg'); background-size: cover;"></div>
<div class="e-card-content">
<h3>Item Title</h3>
<p>Item description and details</p>
</div>
</div>Pattern: Image with Title Overlay
Professional look with text overlaid on image:
<div class="e-card">
<div class="e-card-image" style="position: relative; height: 300px; background-image: url('hero.jpg'); background-size: cover;">
<div class="e-card-title">Hero Title</div>
</div>
<div class="e-card-content">Content below</div>
</div>Pattern: Multiple Images with Separators
Showcase multiple images in one card:
<div class="e-card">
<div class="e-card-image" style="height: 200px; background-image: url('image1.jpg'); background-size: cover;"></div>
<div class="e-card-separator"></div>
<div class="e-card-image" style="height: 200px; background-image: url('image2.jpg'); background-size: cover;"></div>
<div class="e-card-separator"></div>
<div class="e-card-content">Image gallery with descriptions</div>
</div>---
Troubleshooting
Issue: Image not displaying
- Check:
background-imageURL is correct and accessible - Verify:
heightis set (background images need dimensions) - Try: Use
background-size: coverorcontain
Issue: Title text hard to read on image
- Solution: Add gradient overlay with
background: linear-gradient(...) - Try: Increase opacity or add text shadow
Issue: Image looks stretched
- Fix: Use
background-size: coverorcontaininstead ofauto - Ensure: Aspect ratio is consistent
---
Next: Add interactive buttons to cards in Action Buttons reference.
Getting Started with Syncfusion Angular Cards
Table of Contents
- Prerequisites and Setup
- Installing the Card Package
- CSS Theme Configuration
- Creating Your First Card
- Basic Structure
- Adding Headers and Content
- Complete Working Example
---
Prerequisites and Setup
Before implementing Syncfusion Angular Cards, ensure you have:
- Node.js and npm: Latest LTS version installed
- Angular CLI: Version 15+ (Angular 20+ recommended for standalone components)
- Modern Browser: Support for CSS flexbox and modern web standards
- Code Editor: VS Code or similar with TypeScript support
Check Angular Version
ng versionThe Card component works with Angular 12+ but this guide uses Angular 20+ standalone architecture for modern setup patterns.
---
Installing the Card Package
Step 1: Create New Angular Application
ng new syncfusion-card-app
cd syncfusion-card-appWhen prompted, choose:
- Style: CSS (or SCSS if preferred)
- Server-side rendering: Choose your preference
- AI Tool: Select "none" unless you prefer assisted setup
Step 2: Install Syncfusion Layouts Package
The Card component is part of the Syncfusion layouts package:
npm install @syncfusion/ej2-angular-layouts --saveFor Angular versions below 12 (legacy support):
npm install @syncfusion/ej2-angular-layouts@ngcc --saveStep 3: Verify Installation
Check that the package is added to package.json:
{
"dependencies": {
"@syncfusion/ej2-angular-layouts": "^20.2.38",
"@angular/common": "^21.0.0",
"@angular/core": "^21.0.0"
}
}---
CSS Theme Configuration
Step 1: Add Theme Files
Open src/styles.css and add the Syncfusion CSS imports:
/* Syncfusion CSS Theme - Choose one theme */
@import '../node_modules/@syncfusion/ej2-base/styles/material3.css';
@import '../node_modules/@syncfusion/ej2-layouts/styles/material3.css';Available Themes:
material3.css— Modern Material Design 3 (recommended)material.css— Material Design (classic)bootstrap5.css— Bootstrap 5 stylingfluent.css— Microsoft Fluent designtailwind.css— Tailwind CSS theme
Step 2: Application Styles
Your src/styles.css should now include:
/* Global Styles */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
body {
font-family: 'Roboto', 'Segoe UI', sans-serif;
background-color: #f5f5f5;
}
/* Syncfusion Themes */
@import '../node_modules/@syncfusion/ej2-base/styles/material3.css';
@import '../node_modules/@syncfusion/ej2-layouts/styles/material3.css';
/* Custom overrides (optional) */
.custom-container {
max-width: 1200px;
margin: 0 auto;
padding: 20px;
}---
Creating Your First Card
Step 1: Component Setup
Create or update src/app/app.component.ts:
import { Component } from '@angular/core';
import { CommonModule } from '@angular/common';
@Component({
selector: 'app-root',
standalone: true,
imports: [CommonModule],
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
title = 'My First Card';
}Step 2: HTML Template
Create or update src/app/app.component.html:
<div class="container">
<h1>{{ title }}</h1>
<div class="e-card">
<div class="e-card-header">
<div class="e-card-header-caption">
<div class="e-card-header-title">Welcome to Syncfusion Cards</div>
</div>
</div>
<div class="e-card-content">
This is your first Syncfusion Angular Card component!
</div>
</div>
</div>Step 3: Component Styles
Create or update src/app/app.component.css:
.container {
padding: 20px;
max-width: 800px;
margin: 0 auto;
}
.e-card {
margin-top: 20px;
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}Step 4: Run the Application
npm startNavigate to http://localhost:4200/. Your first card will be displayed!
---
Basic Structure
The Card component uses a semantic HTML structure with CSS classes:
<div class="e-card"> <!-- Root card container -->
<div class="e-card-header"> <!-- Header section (optional) -->
<div class="e-card-header-caption"> <!-- Caption wrapper -->
<div class="e-card-header-title">Title</div>
<div class="e-card-sub-title">Subtitle</div>
</div>
</div>
<div class="e-card-content"> <!-- Main content area -->
Card content goes here
</div>
<div class="e-card-actions"> <!-- Actions section (optional) -->
<button class="e-card-btn">Action</button>
</div>
</div>Key Points:
- All sections are optional
- Styling is pure CSS (no JavaScript)
- Structure follows DOM natural flow for accessibility
- CSS classes provide semantic meaning
---
Adding Headers and Content
Simple Header Example
<div class="e-card">
<div class="e-card-header">
<div class="e-card-header-caption">
<div class="e-card-header-title">Card Title</div>
</div>
</div>
<div class="e-card-content">
This is the main content area of the card.
</div>
</div>Header with Subtitle
<div class="e-card">
<div class="e-card-header">
<div class="e-card-header-caption">
<div class="e-card-header-title">Main Title</div>
<div class="e-card-sub-title">Supporting subtitle or description</div>
</div>
</div>
<div class="e-card-content">
Main content goes here.
</div>
</div>Content Area Patterns
The content section is flexible and can contain:
<div class="e-card-content">
<!-- Text content -->
<p>Simple paragraph text</p>
<!-- Lists -->
<ul>
<li>Item 1</li>
<li>Item 2</li>
</ul>
<!-- Multiple paragraphs -->
<p>Paragraph 1</p>
<p>Paragraph 2</p>
</div>---
Complete Working Example
Here's a complete, ready-to-use example with header, content, and basic styling:
app.component.ts
import { Component } from '@angular/core';
import { CommonModule } from '@angular/common';
@Component({
selector: 'app-root',
standalone: true,
imports: [CommonModule],
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent {
cards = [
{
id: 1,
title: 'JavaScript Succinctly',
subtitle: 'Essential Programming Concepts',
content: 'A comprehensive guide to JavaScript fundamentals, objects, scope, inheritance, and more for developers at any level.'
},
{
id: 2,
title: 'Angular Best Practices',
subtitle: 'Modern Web Development',
content: 'Master standalone components, dependency injection, reactive forms, and build scalable Angular applications.'
},
{
id: 3,
title: 'Web Performance',
subtitle: 'Optimization Techniques',
content: 'Learn lazy loading, code splitting, bundling optimization, and performance monitoring techniques.'
}
];
}app.component.html
<div class="container">
<h1>Getting Started with Cards</h1>
<p class="subtitle">Multiple card examples with headers and content</p>
<div class="cards-grid">
<div class="e-card" *ngFor="let card of cards">
<div class="e-card-header">
<div class="e-card-header-caption">
<div class="e-card-header-title">{{ card.title }}</div>
<div class="e-card-sub-title">{{ card.subtitle }}</div>
</div>
</div>
<div class="e-card-content">
{{ card.content }}
</div>
<div class="e-card-actions">
<button class="e-card-btn">Learn More</button>
<button class="e-card-btn">Save</button>
</div>
</div>
</div>
</div>app.component.css
.container {
padding: 40px 20px;
max-width: 1200px;
margin: 0 auto;
background-color: #f5f5f5;
min-height: 100vh;
}
h1 {
color: #333;
margin-bottom: 10px;
font-size: 32px;
}
.subtitle {
color: #666;
margin-bottom: 30px;
font-size: 16px;
}
.cards-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
gap: 24px;
}
.e-card {
transition: box-shadow 0.3s ease, transform 0.3s ease;
}
.e-card:hover {
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
transform: translateY(-4px);
}
.e-card-header {
padding: 16px;
background-color: #f9f9f9;
border-bottom: 1px solid #eee;
}
.e-card-header-title {
font-size: 18px;
font-weight: 600;
color: #333;
}
.e-card-sub-title {
font-size: 14px;
color: #999;
margin-top: 4px;
}
.e-card-content {
padding: 16px;
line-height: 1.6;
color: #555;
}
.e-card-actions {
display: flex;
gap: 8px;
padding: 12px 16px;
border-top: 1px solid #eee;
}
.e-card-btn {
flex: 1;
padding: 10px 16px;
border: none;
border-radius: 4px;
background-color: #007bff;
color: white;
cursor: pointer;
font-size: 14px;
font-weight: 500;
transition: background-color 0.2s ease;
}
.e-card-btn:hover {
background-color: #0056b3;
}
.e-card-btn:active {
background-color: #003d82;
}main.ts (Bootstrap)
import { bootstrapApplication } from '@angular/platform-browser';
import { AppComponent } from './app/app.component';
import 'zone.js';
bootstrapApplication(AppComponent).catch((err) => console.error(err));---
Next Steps
Now that you have your first card working:
1. Add Headers with Images: See Card Headers to include images in headers 2. Include Content Images: Read Card Images to add images to content 3. Interactive Buttons: Explore Action Buttons for event handling 4. Horizontal Layouts: Check Horizontal Layout for side-by-side layouts 5. Custom Styling: Visit Styling and Customization for CSS techniques
---
Common Issues
Issue: Cards not displaying
- Check: Are CSS imports in
src/styles.css? - Verify: Package installation:
npm list @syncfusion/ej2-angular-layouts
Issue: Styles not applying
- Check: Development server restarted after CSS changes
- Verify: Theme CSS is imported before custom styles
Issue: TypeScript errors
- Check: Using
standalone: truein component - Update:
ng versionto ensure Angular 20+
---
Ready for more? Each reference file builds on these fundamentals with advanced patterns and techniques.
Horizontal Layout in Syncfusion Angular Cards
Table of Contents
- Horizontal Card Layout
- Using e-card-horizontal Class
- Stacked Sections
- Element Positioning
- Combining Images with Content
- Responsive Horizontal Layout
- Complete Examples
---
Horizontal Card Layout
By default, all card elements stack vertically following the natural DOM flow. Horizontal layout arranges elements side-by-side (left to right), creating more compact cards that are ideal for:
- Product previews with image and details
- User profile cards with avatar and information
- Media listings with thumbnail and metadata
- Compact item cards with icon and description
Vertical vs Horizontal
Default Vertical Layout:
<div class="e-card">
<!-- Elements stack vertically -->
<div class="e-card-image"></div>
<div class="e-card-header"></div>
<div class="e-card-content"></div>
</div>Horizontal Layout:
<div class="e-card e-card-horizontal">
<!-- Elements arrange side-by-side -->
<img src="image.jpg" alt="Image">
<div class="e-card-stacked">
<div class="e-card-header"></div>
<div class="e-card-content"></div>
</div>
</div>---
Using e-card-horizontal Class
Basic Horizontal Setup
Add the e-card-horizontal class to the card root to enable horizontal layout:
<div class="e-card e-card-horizontal">
<img src="product.jpg" alt="Product" style="width: 200px; height: 200px;">
<div>
<div class="e-card-header">
<div class="e-card-header-caption">
<div class="e-card-header-title">Product Name</div>
</div>
</div>
<div class="e-card-content">
Product description goes here
</div>
</div>
</div>CSS for Horizontal Layout
.e-card.e-card-horizontal {
display: flex;
flex-direction: row;
gap: 16px;
}
.e-card.e-card-horizontal > * {
flex-shrink: 0;
}
.e-card.e-card-horizontal img {
object-fit: cover;
}Element Order
Elements in the HTML maintain their visual order:
<!-- Image appears on left, content on right -->
<div class="e-card e-card-horizontal">
<img src="left.jpg">
<div class="content">Content</div>
</div>
<!-- Image appears on right, content on left -->
<div class="e-card e-card-horizontal">
<div class="content">Content</div>
<img src="right.jpg">
</div>---
Stacked Sections
The e-card-stacked class forces vertical alignment for specific sections within a horizontal layout, creating mixed layouts:
Basic Stacked Usage
<div class="e-card e-card-horizontal">
<img src="image.jpg" alt="Image" style="width: 150px; height: 150px;">
<div class="e-card-stacked">
<!-- Everything inside this div stacks vertically -->
<div class="e-card-header">
<div class="e-card-header-caption">
<div class="e-card-header-title">Title</div>
</div>
</div>
<div class="e-card-content">Content</div>
</div>
</div>CSS for Stacked Layout
.e-card-stacked {
display: flex;
flex-direction: column;
gap: 8px;
flex: 1;
}
.e-card-stacked > * {
margin: 0;
}Multiple Stacked Sections
<div class="e-card e-card-horizontal">
<div class="e-card-stacked">
<div class="e-card-header">Header 1</div>
<div class="e-card-content">Content 1</div>
</div>
<div class="e-card-stacked">
<div class="e-card-header">Header 2</div>
<div class="e-card-content">Content 2</div>
</div>
</div>---
Element Positioning
Image on Left (Default)
<div class="e-card e-card-horizontal">
<img src="image.jpg" alt="Left" style="width: 180px; height: 180px; object-fit: cover;">
<div class="e-card-stacked">
<div class="e-card-header">
<div class="e-card-header-title">Title</div>
</div>
<div class="e-card-content">Description</div>
</div>
</div>Image on Right
<div class="e-card e-card-horizontal">
<div class="e-card-stacked">
<div class="e-card-header">
<div class="e-card-header-title">Title</div>
</div>
<div class="e-card-content">Description</div>
</div>
<img src="image.jpg" alt="Right" style="width: 180px; height: 180px; object-fit: cover;">
</div>Image Sizing Options
<!-- Small thumbnail -->
<img src="image.jpg" style="width: 80px; height: 80px; object-fit: cover;">
<!-- Medium size -->
<img src="image.jpg" style="width: 150px; height: 150px; object-fit: cover;">
<!-- Large image -->
<img src="image.jpg" style="width: 250px; height: 250px; object-fit: cover;">
<!-- Full height -->
<img src="image.jpg" style="width: auto; height: 100%; object-fit: cover;">---
Combining Images with Content
Image + Header + Content Pattern (from utils)
// horizontal-card.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-horizontal-card',
standalone: true,
template: `
<div style="margin: 50px;display: flex;flex-direction: row;justify-content: center;">
<div tabindex="0" class="e-card e-card-horizontal" style="width:400px">
<img src="./Code.png" alt="Sample" style="height: 180px">
<div class="e-card-stacked">
<div class="e-card-header">
<div class="e-card-header-caption">
<div class="e-card-header-title">Philips Trimmer</div>
</div>
</div>
<div class="e-card-content">
Powered by the innovative DuraPower Technology which optimizes power consumption, Philips trimmers are designed to last longer
than 4 ordinary trimmers.
</div>
</div>
</div>
</div>
`
})
export class HorizontalCardComponent {}Image + Actions
<div class="e-card e-card-horizontal">
<img src="product.jpg" style="width: 140px; height: 140px; object-fit: cover;">
<div class="e-card-stacked">
<div class="e-card-header">
<div class="e-card-header-title">Product</div>
</div>
<div class="e-card-content">Description</div>
<div class="e-card-actions">
<button class="e-card-btn">Add</button>
<button class="e-card-btn">Share</button>
</div>
</div>
</div>Compact Horizontal Card
Minimal horizontal card with image, title, and single action:
<div class="e-card e-card-horizontal" style="max-width: 350px;">
<img src="icon.svg" style="width: 80px; height: 80px; object-fit: contain;">
<div class="e-card-stacked">
<div class="e-card-header">
<div class="e-card-header-title" style="font-size: 16px;">Feature Name</div>
</div>
<div class="e-card-content" style="font-size: 13px;">Quick description</div>
</div>
</div>---
Responsive Horizontal Layout
Mobile to Desktop Adaptation
/* Desktop: Horizontal layout */
@media (min-width: 768px) {
.e-card.responsive-card {
display: flex;
flex-direction: row;
gap: 16px;
}
.e-card.responsive-card img {
width: 200px;
height: 200px;
}
}
/* Mobile: Vertical layout */
@media (max-width: 767px) {
.e-card.responsive-card {
display: flex;
flex-direction: column;
gap: 0;
}
.e-card.responsive-card img {
width: 100%;
height: auto;
}
}Component with Responsive Layout
// responsive-card.component.ts
import { Component, HostListener } from '@angular/core';
@Component({
selector: 'app-responsive-card',
standalone: true,
template: `
<div class="e-card" [class.e-card-horizontal]="isDesktop">
<img src="product.jpg" alt="Product" style="width: 150px; height: 150px; object-fit: cover;">
<div [class.e-card-stacked]="isDesktop">
<div class="e-card-header">
<div class="e-card-header-title">Responsive Card</div>
</div>
<div class="e-card-content">
This card switches between horizontal (desktop) and vertical (mobile) layouts
</div>
</div>
</div>
`,
styles: [`
.e-card {
max-width: 500px;
}
`]
})
export class ResponsiveCardComponent {
isDesktop = window.innerWidth >= 768;
@HostListener('window:resize', ['$event'])
onResize(event: Event) {
this.isDesktop = window.innerWidth >= 768;
}
}---
Complete Examples
Example 1: Product Card (Horizontal)
// product-card.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-product-card',
standalone: true,
template: `
<div class="product-container">
<div class="e-card e-card-horizontal">
<img src="assets/laptop.jpg" alt="Laptop" style="width: 180px; height: 180px; object-fit: cover; border-radius: 4px;">
<div class="e-card-stacked" style="flex: 1;">
<div class="e-card-header">
<div class="e-card-header-caption">
<div class="e-card-header-title">Premium Laptop</div>
<div class="e-card-sub-title">Electronics • New Arrival</div>
</div>
</div>
<div class="e-card-content">
<p><strong>Price:</strong> $999.99</p>
<p>High-performance laptop with latest processors and vibrant display.</p>
</div>
<div class="e-card-actions">
<button class="e-card-btn">View Details</button>
<button class="e-card-btn">Add to Cart</button>
</div>
</div>
</div>
</div>
`,
styles: [`
.product-container {
padding: 20px;
}
`]
})
export class ProductCardComponent {}Example 2: Team Member Card (Horizontal)
// team-member-card.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-team-member-card',
standalone: true,
template: `
<div class="e-card e-card-horizontal" style="max-width: 450px;">
<div style="width: 100px; height: 100px; background-image: url('assets/avatar.jpg');
background-size: cover; border-radius: 8px;"></div>
<div class="e-card-stacked">
<div class="e-card-header">
<div class="e-card-header-caption">
<div class="e-card-header-title">Sarah Johnson</div>
<div class="e-card-sub-title">Senior Product Manager</div>
</div>
</div>
<div class="e-card-content" style="font-size: 13px; line-height: 1.5;">
<p><strong>Email:</strong> sarah@company.com</p>
<p><strong>Team:</strong> Product Development</p>
</div>
<div class="e-card-actions">
<a href="mailto:sarah@company.com" class="e-card-btn">Contact</a>
<button class="e-card-btn">View Profile</button>
</div>
</div>
</div>
`
})
export class TeamMemberCardComponent {}Example 3: Feature Card Grid
// feature-cards.component.ts
import { Component } from '@angular/core';
import { CommonModule } from '@angular/common';
interface Feature {
icon: string;
title: string;
description: string;
}
@Component({
selector: 'app-feature-cards',
standalone: true,
imports: [CommonModule],
template: `
<div class="features-grid">
<div class="e-card e-card-horizontal" *ngFor="let feature of features">
<img [src]="feature.icon" alt="{{ feature.title }}" style="width: 80px; height: 80px; object-fit: contain; padding: 10px;">
<div class="e-card-stacked">
<div class="e-card-header">
<div class="e-card-header-title" style="font-size: 16px;">{{ feature.title }}</div>
</div>
<div class="e-card-content" style="font-size: 13px;">
{{ feature.description }}
</div>
</div>
</div>
</div>
`,
styles: [`
.features-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
gap: 16px;
padding: 20px;
}
.e-card {
border: 1px solid #eee;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}
.e-card:hover {
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}
`]
})
export class FeatureCardsComponent {
features: Feature[] = [
{
icon: 'assets/speed.svg',
title: 'Lightning Fast',
description: 'Optimized performance for instant loading and smooth interactions'
},
{
icon: 'assets/secure.svg',
title: 'Secure',
description: 'Enterprise-grade security with end-to-end encryption'
},
{
icon: 'assets/scalable.svg',
title: 'Scalable',
description: 'Grows with your business from startup to enterprise'
}
];
}Example 4: Article Preview Card
// article-preview.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-article-preview',
standalone: true,
template: `
<div class="e-card e-card-horizontal" style="max-width: 600px;">
<img src="assets/article-thumb.jpg" alt="Article" style="width: 150px; height: 150px; object-fit: cover;">
<div class="e-card-stacked">
<div class="e-card-header">
<div class="e-card-header-caption">
<div class="e-card-header-title">Angular Performance Best Practices</div>
<div class="e-card-sub-title">By Jane Smith • Mar 27, 2026</div>
</div>
</div>
<div class="e-card-content">
Learn essential techniques to optimize your Angular applications for peak performance. This comprehensive guide covers lazy loading, change detection optimization, and more.
</div>
<div class="e-card-actions">
<button class="e-card-btn">Read Article</button>
<button class="e-card-btn">Save</button>
</div>
</div>
</div>
`
})
export class ArticlePreviewComponent {}---
Common Patterns
Pattern: Icon + Information
Quick horizontal layout for list items:
<div class="e-card e-card-horizontal" style="padding: 12px;">
<img src="icon.svg" style="width: 40px; height: 40px;">
<div class="e-card-stacked" style="gap: 0;">
<div style="font-weight: 600; font-size: 14px;">Title</div>
<div style="font-size: 12px; color: #666;">Subtitle</div>
</div>
</div>Pattern: Image + Quick Details
Compact product or item display:
<div class="e-card e-card-horizontal" style="max-width: 280px;">
<img src="product.jpg" style="width: 100px; height: 100px;">
<div class="e-card-stacked">
<div class="e-card-header-title" style="font-size: 14px;">Product</div>
<div class="e-card-content" style="font-size: 12px;">Quick description</div>
</div>
</div>---
Styling Tips
Make horizontal cards stand out:
.e-card.e-card-horizontal {
box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
border-radius: 8px;
overflow: hidden;
}
.e-card.e-card-horizontal:hover {
box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
transform: translateY(-2px);
transition: all 0.2s ease;
}
.e-card.e-card-horizontal img {
border-radius: 4px;
}---
Troubleshooting
Issue: Elements not appearing side-by-side
- Check:
e-card-horizontalclass is applied - Verify: Parent has
display: flex; flex-direction: row;
Issue: Content overflowing
- Solution: Add
overflow: hiddento card - Or: Use
flex: 1on content wrapper
Issue: Image distorted
- Fix: Use
object-fit: coverorcontain - Ensure: Image has explicit width and height
---
Next: Customize card appearance in Styling and Customization reference.
Styling and Customization in Syncfusion Angular Cards
Table of Contents
- CSS Class Hierarchy
- Customizing Card Appearance
- Header Styling
- Content Styling
- Image Customization
- Button Styling
- Divider Customization
- Layout Styling
- Theme Integration
- Advanced Patterns
---
CSS Class Hierarchy
Understanding the Card's CSS structure enables precise customization:
.e-card (Root container)
├── .e-card-header (Header section)
│ ├── .e-card-header-image (Avatar/icon)
│ └── .e-card-header-caption (Text wrapper)
│ ├── .e-card-header-title (Main title)
│ └── .e-card-sub-title (Subtitle)
├── .e-card-image (Content image with optional title)
│ └── .e-card-title (Image overlay title)
├── .e-card-content (Main content area)
├── .e-card-separator (Visual divider)
└── .e-card-actions (Button container)
└── .e-card-btn (Individual buttons)---
Customizing Card Appearance
Basic Card Styling
Customize the root card container:
.e-card {
background-color: white;
border: 1px solid #ddd;
border-radius: 4px;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
overflow: hidden;
}Card Padding and Spacing
.e-card {
padding: 0; /* Content sections handle their own padding */
}
/* Optional: Add padding around entire card */
.e-card-wrapper {
padding: 16px;
}Card Background Colors
Solid Color:
.e-card {
background-color: #f5f5f5;
}Gradient Background:
.e-card {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
}Image Background:
.e-card {
background-image: url('pattern.png');
background-size: 200px;
background-repeat: repeat;
}Card Border Customization
/* Thick border */
.e-card {
border: 3px solid #007bff;
border-radius: 8px;
}
/* Colored left border */
.e-card {
border-left: 4px solid #28a745;
}
/* Rounded corners */
.e-card {
border-radius: 12px;
}
/* Soft shadows */
.e-card {
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}
/* Strong shadows */
.e-card {
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
}Card Hover Effects
.e-card {
transition: all 0.3s ease;
}
.e-card:hover {
box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
transform: translateY(-4px);
}
/* Lift effect */
.e-card:hover {
transform: translateY(-8px);
box-shadow: 0 12px 24px rgba(0, 0, 0, 0.2);
}
/* Scale effect */
.e-card:hover {
transform: scale(1.02);
}---
Header Styling
Header Container
.e-card-header {
display: flex;
align-items: center;
padding: 16px;
background-color: #f9f9f9;
border-bottom: 1px solid #eee;
}Header Title Styling
.e-card-header-title {
font-size: 18px;
font-weight: 600;
color: #333;
margin: 0;
}
/* Large title */
.e-card-header-title {
font-size: 22px;
font-weight: 700;
}
/* Colored title */
.e-card-header-title {
color: #007bff;
}
/* Title with underline */
.e-card-header-title {
border-bottom: 2px solid #007bff;
padding-bottom: 8px;
}Header Subtitle Styling
.e-card-header .e-card-sub-title {
font-size: 14px;
color: #999;
margin-top: 4px;
font-weight: 400;
}
/* Colored subtitle */
.e-card-header .e-card-sub-title {
color: #28a745;
}
/* Styled subtitle */
.e-card-header .e-card-sub-title {
font-style: italic;
letter-spacing: 0.5px;
}Header Image Styling
.e-card-header-image {
width: 48px;
height: 48px;
border-radius: 4px;
margin-right: 12px;
object-fit: cover;
}
/* Circular image */
.e-card-header-image {
border-radius: 50%;
}
/* Image with border */
.e-card-header-image {
border: 2px solid #ddd;
}
/* Image with shadow */
.e-card-header-image {
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}Colored Header Backgrounds
/* Blue header */
.e-card-header {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
border-bottom: none;
color: white;
}
.e-card-header .e-card-header-title {
color: white;
}
.e-card-header .e-card-sub-title {
color: rgba(255, 255, 255, 0.9);
}
/* Dark header */
.e-card-header {
background-color: #333;
}
.e-card-header .e-card-header-title {
color: white;
}---
Content Styling
Card Content Area
.e-card-content {
padding: 16px;
color: #555;
line-height: 1.6;
}
/* Larger content padding */
.e-card-content {
padding: 24px;
}
/* Content with background */
.e-card-content {
background-color: #f5f5f5;
}Content Text Styling
.e-card-content {
font-size: 14px;
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
/* Justified text */
.e-card-content {
text-align: justify;
}
/* Monospace text (for code) */
.e-card-content code {
background: #f0f0f0;
padding: 2px 6px;
border-radius: 3px;
font-family: 'Courier New', monospace;
}Content Lists
.e-card-content ul,
.e-card-content ol {
margin: 12px 0;
padding-left: 24px;
}
.e-card-content li {
margin-bottom: 6px;
}Multiple Content Sections
.e-card-content + .e-card-content {
border-top: 1px solid #eee;
padding-top: 16px;
}---
Image Customization
Card Image Container
.e-card-image {
background-size: cover;
background-position: center;
height: 250px;
position: relative;
}
/* Responsive height */
.e-card-image {
width: 100%;
aspect-ratio: 16 / 9;
}
/* Square image */
.e-card-image {
aspect-ratio: 1 / 1;
}Image Filters
/* Brightness */
.e-card-image {
filter: brightness(0.8);
}
/* Grayscale */
.e-card-image {
filter: grayscale(100%);
}
/* Sepia effect */
.e-card-image {
filter: sepia(30%);
}
/* Blur effect */
.e-card-image {
filter: blur(2px);
}
/* Multiple filters */
.e-card-image {
filter: brightness(0.9) contrast(1.1) saturate(1.2);
}
/* Hover effect */
.e-card:hover .e-card-image {
filter: brightness(1) grayscale(0%);
}Image Gradient Overlay
/* Gradient overlay for text contrast */
.e-card-image::before {
content: '';
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
background: linear-gradient(135deg, rgba(102, 126, 234, 0.3), rgba(118, 75, 162, 0.3));
z-index: 1;
}
/* Dark overlay */
.e-card-image::before {
background: rgba(0, 0, 0, 0.4);
}
/* Gradient overlay (top to bottom) */
.e-card-image::before {
background: linear-gradient(to bottom, rgba(0, 0, 0, 0.6), transparent);
}Image Title Positioning
/* Bottom-left (default) */
.e-card-image .e-card-title {
position: absolute;
bottom: 0;
left: 0;
right: 0;
background: linear-gradient(to top, rgba(0,0,0,0.6), transparent);
color: white;
padding: 12px 16px;
z-index: 2;
}
/* Top-left */
.e-card-image .e-card-title.top-left {
top: 0;
bottom: auto;
background: linear-gradient(to bottom, rgba(0,0,0,0.6), transparent);
}
/* Top-right */
.e-card-image .e-card-title.top-right {
top: 0;
bottom: auto;
left: auto;
right: 0;
text-align: right;
background: linear-gradient(to bottom, rgba(0,0,0,0.6), transparent);
}
/* Bottom-right */
.e-card-image .e-card-title.bottom-right {
right: 0;
left: auto;
text-align: right;
background: linear-gradient(to top, rgba(0,0,0,0.6), transparent);
}---
Button Styling
Button Container
.e-card-actions {
display: flex;
gap: 8px;
padding: 12px 16px;
background-color: #f5f5f5;
border-top: 1px solid #eee;
}Button Styling
.e-card-btn {
flex: 1;
padding: 10px 16px;
background-color: white;
color: #333;
border: 1px solid #ddd;
border-radius: 4px;
font-size: 14px;
font-weight: 500;
cursor: pointer;
transition: all 0.2s ease;
}
.e-card-btn:hover {
background-color: #f0f0f0;
border-color: #999;
}
.e-card-btn:active {
background-color: #e0e0e0;
}Themed Buttons
/* Primary button */
.e-card-btn.primary {
background-color: #007bff;
color: white;
border-color: #007bff;
}
.e-card-btn.primary:hover {
background-color: #0056b3;
}
/* Success button */
.e-card-btn.success {
background-color: #28a745;
color: white;
border-color: #28a745;
}
/* Danger button */
.e-card-btn.danger {
background-color: #dc3545;
color: white;
border-color: #dc3545;
}
/* Outline button */
.e-card-btn.outline {
background-color: transparent;
color: #007bff;
border: 2px solid #007bff;
}
.e-card-btn.outline:hover {
background-color: #007bff;
color: white;
}---
Divider Customization
Basic Divider
.e-card-separator {
height: 1px;
background-color: #ddd;
margin: 16px 0;
}Custom Divider Styles
/* Thick divider */
.e-card-separator {
height: 3px;
background-color: #999;
}
/* Colored divider */
.e-card-separator {
height: 2px;
background: linear-gradient(to right, #667eea, #764ba2);
}
/* Dashed divider */
.e-card-separator {
height: 0;
border-top: 1px dashed #ccc;
margin: 12px 0;
}
/* Dotted divider */
.e-card-separator {
height: 0;
border-top: 1px dotted #ccc;
}
/* Reduced spacing */
.e-card-separator {
margin: 8px 0;
}
/* Increased spacing */
.e-card-separator {
margin: 24px 0;
}
/* With padding */
.e-card-separator {
padding: 12px 0;
border-top: 1px solid #eee;
}---
Layout Styling
Horizontal Layout
.e-card-horizontal {
display: flex;
flex-direction: row;
gap: 16px;
}
.e-card-horizontal > * {
flex-shrink: 0;
}
.e-card-stacked {
display: flex;
flex-direction: column;
gap: 0;
flex: 1;
}Responsive Layout
/* Desktop */
@media (min-width: 768px) {
.e-card-responsive {
display: flex;
flex-direction: row;
}
.e-card-responsive img {
width: 200px;
height: 200px;
}
}
/* Mobile */
@media (max-width: 767px) {
.e-card-responsive {
display: flex;
flex-direction: column;
}
.e-card-responsive img {
width: 100%;
height: auto;
}
}---
Theme Integration
Material Design 3 Theme
/* Material 3 primary colors */
:root {
--md-sys-color-primary: #006fbe;
--md-sys-color-on-primary: #ffffff;
--md-sys-color-surface: #fffbfe;
--md-sys-color-on-surface: #1c1b1f;
}
.e-card {
background-color: var(--md-sys-color-surface);
color: var(--md-sys-color-on-surface);
}
.e-card-header {
background-color: var(--md-sys-color-primary);
color: var(--md-sys-color-on-primary);
}Dark Mode
@media (prefers-color-scheme: dark) {
.e-card {
background-color: #222;
color: #eee;
border-color: #444;
}
.e-card-header {
background-color: #333;
border-color: #444;
}
.e-card-actions {
background-color: #333;
border-color: #444;
}
.e-card-btn {
background-color: #444;
color: #eee;
border-color: #555;
}
.e-card-separator {
background-color: #444;
}
}---
Advanced Patterns
Glassmorphism Effect
.e-card {
background: rgba(255, 255, 255, 0.1);
backdrop-filter: blur(10px);
border: 1px solid rgba(255, 255, 255, 0.2);
box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}Neumorphism Effect
.e-card {
background: #e0e5ec;
box-shadow: 9px 9px 16px #a3b1c6, -9px -9px 16px #fff;
}
.e-card:hover {
box-shadow: inset 9px 9px 16px #a3b1c6, inset -9px -9px 16px #fff;
}3D Effect
.e-card {
transform: perspective(1000px) rotateX(0deg) rotateY(0deg);
transition: transform 0.3s ease;
}
.e-card:hover {
transform: perspective(1000px) rotateX(5deg) rotateY(5deg);
}Gradient Text
.e-card-header-title {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-clip: text;
}Animated Border
.e-card {
position: relative;
border: 2px solid;
border-image: linear-gradient(45deg, #667eea, #764ba2) 1;
animation: borderAnimation 3s infinite;
}
@keyframes borderAnimation {
0%, 100% {
border-image: linear-gradient(45deg, #667eea, #764ba2) 1;
}
50% {
border-image: linear-gradient(225deg, #667eea, #764ba2) 1;
}
}Card Elevation
.e-card {
box-shadow: 0 2px 1px -1px rgba(0, 0, 0, 0.2),
0 1px 1px 0 rgba(0, 0, 0, 0.14),
0 1px 3px 0 rgba(0, 0, 0, 0.12);
}
.e-card:hover {
box-shadow: 0 3px 1px -2px rgba(0, 0, 0, 0.2),
0 2px 2px 0 rgba(0, 0, 0, 0.14),
0 1px 5px 0 rgba(0, 0, 0, 0.12);
}---
Complete Styling Example
// styled-card.component.ts
import { Component } from '@angular/core';
@Component({
selector: 'app-styled-card',
standalone: true,
template: `
<div class="premium-card">
<div class="e-card">
<div class="e-card-header">
<div class="e-card-header-image" style="width: 60px; height: 60px; background: linear-gradient(135deg, #667eea, #764ba2); border-radius: 50%;"></div>
<div class="e-card-header-caption">
<div class="e-card-header-title">Premium Card</div>
<div class="e-card-sub-title">Advanced Styling</div>
</div>
</div>
<div class="e-card-image" style="height: 200px; background: linear-gradient(135deg, #667eea, #764ba2);"></div>
<div class="e-card-content">
A beautifully styled card with custom colors, shadows, and effects.
</div>
<div class="e-card-actions">
<button class="e-card-btn primary">Learn More</button>
<button class="e-card-btn outline">Save</button>
</div>
</div>
</div>
`,
styles: [`
.premium-card {
padding: 20px;
}
.e-card {
border-radius: 12px;
overflow: hidden;
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
transition: all 0.3s ease;
}
.e-card:hover {
box-shadow: 0 12px 32px rgba(0, 0, 0, 0.25);
transform: translateY(-4px);
}
.e-card-header {
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
color: white;
}
.e-card-header-title {
color: white;
}
.e-card-sub-title {
color: rgba(255, 255, 255, 0.9) !important;
}
.e-card-content {
padding: 24px;
font-size: 15px;
line-height: 1.6;
}
.e-card-actions {
background: #f5f5f5;
}
.e-card-btn {
padding: 12px 16px;
font-weight: 600;
}
.e-card-btn.primary {
background: #007bff;
color: white;
border: none;
}
.e-card-btn.outline {
background: white;
color: #007bff;
border: 2px solid #007bff;
}
`]
})
export class StyledCardComponent {}---
Troubleshooting
Issue: Styles not applying
- Check: CSS specificity - use more specific selectors if needed
- Verify: Styles load after theme CSS
- Try: Use
!importantas last resort
Issue: Theme colors not working
- Solution: Ensure theme CSS is imported
- Check: Correct theme file name (material3.css vs material.css)
Issue: Hover effects not smooth
- Add:
transition: all 0.3s ease;to elements
---
Ready to create beautiful, custom cards! Each technique builds on CSS fundamentals to create unique card designs that match your brand.