0

This is probably so simple but Iv been hours trying to move a simple title with a border to the center. Many sites now say to use css but I have to use the HTML way. Iv tried using align center but only the words move and not the border with it. Thanks in advance...

The code:

<!DOCTYPE html>
<html>
<head>
  <h1>
<style>.bordered{width: 270px;height: 45px;padding: 10px;border: 5px double grey;}</style>

<div class="bordered"> Title in border</h1>

</div>
</h1>
  • Your HTML is invalid and this question has been asked many, many times before. – Turnip Mar 26 '18 at 16:48
  • All I was finding was answers using css when Im only permitted to use HTML. All of the previous replies went into css and lots of detail I am too new for. Ok Turnip...Im new to this so maybe will try another site. thanks. - also you said it is invalid but after hours it actually displays how I need...just to the left haha...I will keep searching... – user9553543 Mar 26 '18 at 16:53
  • But you are already using CSS. Though your `style` tag should be in the `head`. Everything in the style tag is CSS. – Turnip Mar 26 '18 at 16:53
  • I've linked a question above that tells you how to centre a div. `margin: 0 auto;` – Turnip Mar 26 '18 at 16:56
  • Ok turnip thanks for the heads up - just finding so many sources that wont tell me how to only use html. My course insists only html for now. I will just keep going. Prob too new to be asking questions. Thanks again, – user9553543 Mar 26 '18 at 16:56
  • When I say your HTML is invalid, that is because your opening and closing tags are mismatched. You have a opening div (`
    `) inside a h1 but you close the div (`
    `) after you close the h1 (``). This is not allowed.
    – Turnip Mar 26 '18 at 17:01
  • Gotcha - can see that now will amend. thanks. – user9553543 Mar 26 '18 at 17:16

0 Answers0