Creating Beautiful Feature Cards¶
Feature cards are an excellent way to showcase important features or sections of your documentation in a visually appealing way. They look great on landing pages and help users quickly navigate to important content.
Basic Feature Cards¶
Here's a simple example of feature cards that you can use in your MkDocs Material site:
- HTML
For content and document structure
- JavaScript
For interactive elements and functionality
- CSS
For styling and visual appearance
- Responsive
Works beautifully on all devices
How To Create Feature Cards¶
Creating feature cards in Material for MkDocs is simple. You need three things:
- The required markdown extensions in your
mkdocs.yml
- CSS styling for the cards (which we've already added)
- The proper markdown syntax for creating the cards
Markdown Extensions¶
Make sure you have these extensions in your mkdocs.yml
:
markdown_extensions:
- attr_list
- md_in_html
- pymdownx.emoji:
emoji_index: !!python/name:material.extensions.emoji.twemoji
emoji_generator: !!python/name:material.extensions.emoji.to_svg
Markdown Syntax¶
The basic syntax for creating feature cards is:
<div class="grid cards" markdown>
- :icon-name: __Card Title__
---
Card content goes here
[:octicons-arrow-right-24: Link text](#)
- :icon-name: __Another Card__
---
More content here
[:octicons-arrow-right-24: Another link](#)
</div>
More Complex Example¶
Here's a more complex example showing cards with different icons and styles:
-
Quick Setup
Set up your documentation site in minutes with simple configuration
-
Extensive Documentation
Comprehensive guides and examples for all features
-
Easy Customization
Change colors, fonts, and layouts with simple configuration
-
Responsive Design
Documentation that looks great on any device - desktop, tablet, or mobile
Finding Icons¶
Material for MkDocs includes thousands of icons you can use in your cards:
Use them with syntax like :material-account:
, :fontawesome-brands-github:
or :octicons-rocket-24:
.
Card Sizing¶
You can control the number of columns in your grid by changing the CSS. The default styles adapt to screen size automatically, but you can also create custom CSS rules for specific layouts.
Feature cards are a powerful way to enhance your documentation and create a modern, professional look. They're especially useful for landing pages and section overviews.