How to create flip cards with custom HTML
With custom HTML and CSS, you can fully customize your cards visualization! Follow the steps below to see how you can create flippable cards, or see our other help docs to explore more layout options.
In this article
Note: When using these examples, remember to change the column names displayed with Handlebars syntax {{ }}
. This needs to exactly match the column headers in your own visualization for the custom code to work as expected. For example, if the code reads {{Title}}
, you should have an equivalent column in your datasheet with a header name that reads “Title”.
WARNING: These instructions provide initial guidelines on how to customize your visualization. Since the Cards template allows for greater flexibility with custom HTML and CSS, you will most probably have to adjust the code provided below to create the desired output.
Create flippable cards on hover
TIP: The following HTML code only works in this mode, but don't worry if you don't have an image to use for the front – you can alter the front card content according to your own dataset. We also recommend adjusting all padding to 0, in order for the front content to take up the whole card's width.
{{placeholders}}
with
your column headers.
All data you would like displayed at the front needs to be added under
div class="flip-card-front"
.
Everything that shows up after the flip should be positioned under the
div class="flip-card-back"
div tag.
You can also adjust the image's width and height using the
style
property.
Create flippable cards on click
TIP: The following HTML code only works in this mode, but don't worry if you don't have an image to use for the front – you can alter the front card content according to your own dataset. We also recommend adjusting all padding to 0, in order for the front content to take up the whole card's width.
{{placeholders}}
with
your column headers.
What does each styling section do?
300px
.
background-color
has been set to
transparent, as the underlying visualization already has a color category assigned to each card. You can always replace this with any color.
transition: transform
to something like
1.5s.
.flip-card:hover .flip-card-inner
setting introduces the rotation, whereas the
.flip-card-front, .flip-card-back
bit ensures that the content is being displayed as expected (and not mirrored).
background-color
and
color
settings to apply a desired color for the font and background of your front part.
.flip-card
CSS section, as well as add a margin.
TIP: You may want to adjust your CSS differently for mobile screen sizes. Use the CSS @media rule for more flexibility.