-2

Line breaks are appearing when the DOM is rendered that aren't in my source code, push the content out of place. Why? And how can I fix that? Here is my code:

<div class="float-left" style="position:relative;left:15px">
    <h2 style="color:#323C41;margin-bottom:0;">A New Hope</h2>
    <p style="color:#323C41;">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus vehicula nisl at hendrerit ornare. Ut non ipsum urna. Praesent non.</p>
</div>

When I inspect the page in Chrome, it shows this:

<div class="d-flex justify-content-center align-items-center bg-grey-kr fg-navy-kr secondary">
    <br>
    <img src="/images/testers/rebels.png" alt="Rebel symbol" class="rebel"><br>    <div class="float-left" style="position:relative;left:15px">
    <br>        
    <h2 style="color:#323C41;margin-bottom:0;">A New Hope</h2>
    <br>        
    <p style="color:#323C41;">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus vehicula nisl at hendrerit ornare. Ut non ipsum urna. Praesent non.</p>
    <br>    
</div>

This causes my page to look like this:enter image description here

When I delete the line breaks, I see the expected result: enter image description here

Thanks for checking this out. I searched all morning and couldn't find an answer. Sorry ahead of time if it is obvious!

  • We need to see a [mcve] to even trust that this happens. – Praveen Kumar Purushothaman Jun 22 '18 at 15:49
  • Should I provide the entire code for the page? I don't know why this is happening, so I'm not sure how one could replicate it. I tried to explain the problem in as little code as possible, while still being transparent about what I'm doing. – Hungus Bungus Jun 22 '18 at 15:55

1 Answers1

0

The issue was coming from adding HTML code directly into my "new page" from the Hexo tool. Hexo is a blogging tool that compiles Markdown files into a static, live page. Whenever I was hitting enter to write code on a new line, Markdown took that as if I were hitting enter on a text editor. Moving the code all to one line fixed the issue.

Couldn't find the answer online, but when I figured it out I wanted to post it here for visibility.