skip to Main Content

I have a blog called mazeolog_, here is the troublesome code.

<h1>mazeolog</h1>
<h1 class="blink_me">_</h1>

I’m trying to get 2 h1’s on the same line, but it isn’t working. I looked at this for hours. He the code snippet.

TBH it’s probably really easy (i’m new to HTML), but the best I got was it aligned on the left, but I forgot what i was using, but it goes something like this.

<h1 style="???: inline">...</h1>

2

Answers


  1. you can use h1{display: inline-block;} to achieve your result as well.

    Login or Signup to reply.
  2. It’s beacause h1 is a block element. You read about them here. To make sure that h1 comes in a single line, you can either use flexbox or display: inline. Code will look like as follows:-

    1. Using display: inline-block
    h1 {
      display: inline-block
    }
    
    1. Using flexbox
    <div class="heading-container">
    <h1>mazeolog</h1>
    <h1 class="blink_me">_</h1>
    </div>
    
    .heading-container {
      display: flex;
    }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search