Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

HTML

HTML input elements

can somebody please review my code and explain why the form elements display horizontally and not vertically ?

<!doctype html>

<html lang="en">

<head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <link rel="stylesheet" href="/style.css"> <title>My Form</title> </head>

<body>

    <form action="index.html" method="post">

        <h1> Sign Up </h1>

    <input type="text" id="name" name="user_name">
    <input type="Email" id="mail" name="user_email">
    <input type="password" id="password" name="user_password">

    </form>

</body> </html>

1 Answer

Dan Weru
Dan Weru
47,649 Points

Hey, that is the default behaviour of input elements. If you wan them to display vertically, you have to specify that in the css.

input{
  display:block;
}

One Weru,

thanks for the fast reply. I added the code like you said to the css and it worked perfect thanks so much.