Site logo

Archived topic

Mixing HTML font sizes

3 replies · Started by Louis on January 7, 2019

Viewing posts 1–4 of 4

I need to put smaller text (paragraph) on the same line as H2 or H3 tag text. I don't want to have to use a hard return. I tried adding it in HTMl but it did not work.
Thank you for your help.

Hi there,

you would need to do something like this:

<div class="custom-inline">
    <h2>My H2</h2>
    <p>My pargraph</h2>
</div>

And this CSS:

.custom-inline > * {
    display: inline;
}
.custom-inline h2 {
    margin-right: 0.5em;
}

Yep, personally i always add CSS to the top first to test it, and then move it to somewhere more appropriate if you have it organised. Reason being, if there is an error in your existing CSS then this can break any code that is below it :)

This archived topic is closed to new replies.