Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.