Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Themes & Styling

Inline markdown css

Solved by matteo View solution

Started by matteo 7 years ago · 3 replies · 3759 views
7 years ago

HI guys,

sorry if the question sounds trivial. I'm sure I read this in the online documentation, but I cannot find it anymore.

Is it possible to add some custom css class directly into a markdown file? Supposing to have a page with some headers and you want to change the color (or other style) of only the headers in that page.

Is there a way to easily add some custom css class like:

My header<color:"blue">

?

Thanks for any suggestion and sorry for the noise

Cheers

Matteo

7 years ago

Hi @ghtmtt, you might want to explore Markdown Extra but depending on the theme/setup sometimes this might cause display issues (I have had mixed results). There is more info here: /forum/archive/add-own-classes-in-markdown-html-tags-t6480

You must enable Markdown Extra in your system.yaml configuration file.

7 years ago Solution

Hi Paul,

great thanks. I'm a little bit "afraid" to use Markdown extra because what you described.

I needed to change some headers of the hero class in what is my homepage. I did:

HTML
<div class="title-h3">
<h3>My h3 header</h3>
</div>

in the markdown file, and:

CSS
.title-h3 h3, .title-center h3 {
    font-weight: bold;
    color: #51a351;
    text-shadow: 2px 0 0 #d9c32e, -2px 0 0 #d9c32e, 0 2px 0 #d9c32e, 0 -2px 0 #d9c32e, 1px 1px #d9c32e, -1px -1px 0 #d9c32e, 1px -1px 0 #d9c32e, -1px 1px 0 #d9c32e;

}

in my custom css.

I thought this is a smart solution..

👍 2
7 years ago

Great, wrapping a Div is a great option that you don't have to use Markdown Extra for👍

Suggested topics

Topic Participants Replies Views Activity
Themes & Styling · by Pedro M, 2 months ago
4 198 2 months ago
Themes & Styling · by Ian, 2 months ago
3 94 2 months ago
Themes & Styling · by Norbert, 2 years ago
11 455 3 months ago
Themes & Styling · by Lukáš Findeis, 3 months ago
0 48 3 months ago
Themes & Styling · by Sebadamus, 4 months ago
5 128 3 months ago