How can I help you?
Horizontal in Vue Card component
5 Mar 20267 minutes to read
By default, card elements are stacked vertically in DOM order. To lay out elements side-by-side, add the e-card-horizontal class to the root card element.
Stacked cards
-
An horizontally aligned card can push a specific column to align vertical using
e-card-stackedclass. This will align the stacked section vertically aligned differentiating from horizontal layout.Class | Description ------------ | ------------- `e-card-horizontal` | To align card elements horizontally. `e-card-stacked` | To align elements vertically within the horizontal layout. ``` <div tabindex="0" class="e-card e-card-horizontal"> <img src="code1.png" alt="Sample"> --> Aligned in horizontal <div class="e-card-stacked"> --> Aligned in horizontal // Inside the element all are aligned vertical directions </div> </div> ```
<template>
<div id="app">
<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>
</div>
</template>
<style>
@import '../node_modules/@syncfusion/ej2-base/styles/material3.css';
@import '../node_modules/@syncfusion/ej2-vue-layouts/styles/material3.css';
#container {
visibility: hidden;
}
#loader {
color: #008cff;
height: 40px;
left: 45%;
position: absolute;
top: 45%;
width: 30%;
}
.e-card {
width: 300px
}
</style><template>
<div id="app">
<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>
</div>
</template>
<style>
@import '../node_modules/@syncfusion/ej2-base/styles/material3.css';
@import '../node_modules/@syncfusion/ej2-vue-layouts/styles/material3.css';
#container {
visibility: hidden;
}
#loader {
color: #008cff;
height: 40px;
left: 45%;
position: absolute;
top: 45%;
width: 30%;
}
.e-card {
width: 300px
}
</style> <button class="preview-sample-button" id="PreviewSampleButton-mlk46lp1rtkhca5v0im6wur4pn2hfem9" onclick="LoadPreviewSample('https://ej2.syncfusion.com/vue/documentation/code-snippet/card/horizontal-cs1',this.id);">Preview Sample</button><button class="stackblitz-button" id="StackBlitzButton-mlk46lp1rtkhca5v0im6wur4pn2hfem9" onclick="OpenSampleInStackBlitz('https://ej2.syncfusion.com/vue/documentation/code-snippet/card/horizontal-cs1');"><img class="stackblitz-icon" src="https://cdn.syncfusion.com/documentation/images/StackBlitz-icon.png" alt="Stackblitz Support"/><span class="stackblitz-text">Open in Stackblitz</span></button>