Customize the card image title position in EJ2 TypeScript Card control

11 May 20234 minutes to read

Card Image titles are placed as always Bottom-Left Corner only, You can manually customize to placing titles anywhere over the image by adding styles.

<!DOCTYPE html>
<html lang="en">

    <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="//" rel="stylesheet" />
    <link href="index.css" rel="stylesheet" />
    <script src=""></script>
    <script src="systemjs.config.js"></script>
<script src="" type ="text/javascript"></script>

        <div id='loader'>LOADING....</div>
        <div id='container'>
            <!--element which is going to render the Card-->
            <div class="e-card">
                <div class="e-card-image">
                    <div class="e-card-title">Node.js</div>
                <div class="e-card-content">
                    Node.js is a wildly popular platform for writing web applications that has revolutionized web development in many ways, enjoying
                    support across the open source community as well as industry.
    <div style="Margin: 5px 0;width:300px">
        <select id="title_position">
            <option value="bottom-left">BottomLeft</option>
            <option value="top-left">TopLeft</option>
            <option value="top-right">TopRight</option>
            <option value="bottom-right">BottomRight</option>

import { DropDownList } from '@syncfusion/ej2-dropdowns';

// initialize DropDownList component
let dropDownListObject: DropDownList = new DropDownList({
    placeholder:"Select Position",
    change: changed,

// render initialized DropDownList

function changed(e) {
    let cardEle = document.querySelector('.e-card');
    let titleEle = cardEle.querySelector('.e-card-image .e-card-title');
    titleEle.className = ''
    titleEle.classList.add('e-card-'+ e.value);