# How to align the html input

**URL:** <https://forum.freecodecamp.org/t/how-to-align-the-html-input/424926>\
**Category:** Curriculum Help\
**Tags:** css, html\
**Created:** [October 9, 2020, 11:33pm UTC](https://forum.freecodecamp.org/t/how-to-align-the-html-input/424926 "2020-10-09T23:33:43Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Aimslee](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/aimslee/32/134621_2.png) [@Aimslee](https://forum.freecodecamp.org/u/Aimslee)\
**Post date:** [October 9, 2020, 11:33pm UTC](https://forum.freecodecamp.org/t/how-to-align-the-html-input/424926/1 "2020-10-09T23:33:43Z")

</div>

Hi,  
I’m creating a html form using inputs. When you stack these together, the boxes (where you write in the information) aren’t aligned vertically.

I was wondering if you have any tips to line them up.

```auto
<label for="fname">First Name:</label>
            <input type="text" id="fname" name="fname"><br>
            <label for="lname">Last Name:</label>
            <input type="text" id="lname" name="lname"><br>
            <label for="email">E-mail:</label>
            <input type="text" id="email" name="email"><br>
            <label for="address">Address:</label>
            <input type="text" id="address" name="address"><br>

```

---

<div class="post-metadata">

**Author:** ![jwilkins.oboe](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jwilkins.oboe/32/179497_2.png) [@jwilkins.oboe](https://forum.freecodecamp.org/u/jwilkins.oboe)\
**Post date:** [October 9, 2020, 11:50pm UTC](https://forum.freecodecamp.org/t/how-to-align-the-html-input/424926/2 "2020-10-09T23:50:22Z")

</div>

Hey @Aimslee!

Input tags are inline elements. Unlike block level elements, inline elements do not begin a new line.

FCC has a great article talking about this subject of inline versus block level.

[https://www.freecodecamp.org/news/inline-elements-and-block-elements-in-html-explained/#:~:text=Inline%20Element%3A&text=Inline%20elements%20occupy%20the%20space,\>%20%2C%20etc](https://www.freecodecamp.org/news/inline-elements-and-block-elements-in-html-explained/#:~:text=Inline%20Element%3A&text=Inline%20elements%20occupy%20the%20space,%3E%20%2C%20etc).

You can fix this by using CSS. Get rid of the br tags and instead change the display for the inputs to block like this.

```auto
input {
  display:block;
}

```

Hope that helps!

Happy coding!

---

<div class="post-metadata">

**Author:** ![Aimslee](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/aimslee/32/134621_2.png) [@Aimslee](https://forum.freecodecamp.org/u/Aimslee)\
**Post date:** [October 10, 2020, 12:09am UTC](https://forum.freecodecamp.org/t/how-to-align-the-html-input/424926/3 "2020-10-10T00:09:56Z")

</div>

Wow, this works! 🙂

Do you happen to know how to align them so that only the boxes are lined up? As shown below…

```auto
First Name: [input box]
Last Name: [input box]
E-mail: [input box]
Address: [input box]

```

---

<div class="post-metadata">

**Author:** ![jwilkins.oboe](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/jwilkins.oboe/32/179497_2.png) [@jwilkins.oboe](https://forum.freecodecamp.org/u/jwilkins.oboe)\
**Post date:** [October 10, 2020, 12:30am UTC](https://forum.freecodecamp.org/t/how-to-align-the-html-input/424926/4 "2020-10-10T00:30:22Z")

</div>

You could try this

> **[Styling a form](https://codepen.io/jdwilkin4/pen/JjKozRG?editors=1100)**
>
> ...

---

<div class="post-metadata">

**Author:** ![Aimslee](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/aimslee/32/134621_2.png) [@Aimslee](https://forum.freecodecamp.org/u/Aimslee)\
**Post date:** [October 10, 2020, 1:55am UTC](https://forum.freecodecamp.org/t/how-to-align-the-html-input/424926/5 "2020-10-10T01:55:41Z")

</div>

This is great! Thank you!!!

😃

---

<div class="post-metadata">

**Author:** ![ILM](https://sea3.discourse-cdn.com/freecodecamp/user_avatar/forum.freecodecamp.org/ilm/32/363239_2.png) [@ILM](https://forum.freecodecamp.org/u/ILM)\
**Post date:** [May 31, 2021, 2:58pm UTC](https://forum.freecodecamp.org/t/how-to-align-the-html-input/424926/6 "2021-05-31T14:58:42Z")

</div>

Closed on May 31, 2021, 2:58pm UTC


