How can I help you?
Card image in EJ2 TypeScript Card control
5 Mar 20266 minutes to read
Images
The Card supports including images within its elements. Add an image as a direct element anywhere inside the card root by adding the e-card-image class to a div element. Using the class defined, you can write CSS styles to load images to that element.
By default, card images occupy the full width of their parent element.
<div class = "e-card">
<div class="e-card-image">
</div>
</div>
Title
Card images support including a title or caption for the image. By default, the title is placed over the image in the left-bottom position with an overlay.
<div class = "e-card">
<div class="e-card-image">
<div class="e-card-title"></div>
</div>
</div>
<!DOCTYPE html>
<html lang="en">
<head>
<title>Essential JS 2 Card Component</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
<meta name="description" content="Essential JS 2" />
<meta name="author" content="Syncfusion" />
<link rel="shortcut icon" href="resources/favicon.ico" />
<link href="https://cdn.syncfusion.com/ej2/32.2.3/fluent2.css" rel="stylesheet" />
<link href="index.css" rel="stylesheet" />
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div style="margin: 50px;">
<!--element which is going to render the Card-->
<div class="e-card">
<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>
</div>
</body>
</html>Divider
Dividers are used to separate elements inside the card. Add a divider inside the card elements to visually distinguish different sections or content areas.
- Place a
divelement with thee-card-separatorclass inside the card element to add a divider.
<!DOCTYPE html>
<html lang="en">
<head>
<title>Essential JS 2 Card Component</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" />
<meta name="description" content="Essential JS 2" />
<meta name="author" content="Syncfusion" />
<link rel="shortcut icon" href="resources/favicon.ico" />
<link href="index.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/32.2.3/fluent2.css" rel="stylesheet" />
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div style="margin: 50px;">
<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>
</div>
</body>
</html>