Skip to content

Making h1 elements inline #147

Answered by yhatt
mil-ad asked this question in Q&A
Aug 18, 2021 · 1 comments · 1 reply
Discussion options

You must be logged in to vote

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 element was a block container, but it may not yet work in some Marp themes because they are using section as a flex container (required for vertical centering) and its children are stretching to fit the container. In this case, try using align-self: flex-start; instead of display: inline;.

section.my_custom_class h1 {
    align-self: flex-start;
    background: red;
}

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@mil-ad
Comment options

Answer selected by yhatt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants