Search code examples
buttonborder

<br> Tag under buttons


I'm just starting to learn HTML, and I'm stuck with this problem. I'm trying to create buttons with a border underneath but with my code, the border only partially shows up. Any suggestions? Thanks!

What I have:

<div>
<h1>
<a href="index.htm" target="_self"><button class="btn-group">Home</button></a>
<a href="newpage.htm" target="_self"><button class="btn-group">Test</button></a>
</h1?
</div>

<br>

Here is a fiddle: https://jsfiddle.net/koalamonkeys/17rhwcvt/


Solution

  • There are a few issues with your HTML:

    • The buttons are in a <h1> tag, which also isn't closed properly (</h1?). Remove these h1 completely.
    • One of the divs isn't closed. Add another </div> after the existing one.

    The horizontal line should then be full width.

    Although it has no effect on the line, there is also a superfluous </style> towards the end.

    JSFiddle highlights tag issues with a red background. You should strive to resolve any such issues to avoid unpredictable rendering of the page.