-
I'm trying to change the background colour for I'm only interested in changing the background of the text part so I thought I could add this to my css: section.my_custom_class {
h1 {
display: inline;
background: red;
}
} but h1 tags still span the whole line. Am I doing something wrong? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
CSS cannot nest selectors so you have to style like this: section.my_custom_class h1 {
display: inline;
background: red;
} It would work if the section.my_custom_class h1 {
align-self: flex-start;
background: red;
} |
Beta Was this translation helpful? Give feedback.
CSS cannot nest selectors so you have to style like this:
It would work if the
section
element was a block container, but it may not yet work in some Marp themes because they are usingsection
as a flex container (required for vertical centering) and its children are stretching to fit the container. In this case, try usingalign-self: flex-start;
instead ofdisplay: inline;
.