0

Website for my university assignment,

I'm creating a form for my website in JavaScript, I need the different input boxes to be aligned and I'm struggling with how to do that.

This is the code I already have as well as the CSS classes I am including.

.booking1 {
  position: relative;
  float: left;
  padding: 0px;
}

.booking2 {
  position: relative;
  float: right;
  padding-top: 10px;
  padding-left: 200px;
}
<table>
  <th scope="col" class="booking1">
    <div class="form">
      <form method="post" action="mailto:joshua.harvey2@stu.mmu.ac.uk" name="ContactForm" onsubmit="return ValidateContactForm();">
        <p>Name: <input type="text" size="35" name="Name"></p>
        <p>E-mail Address: <input type="text" size="35" name="Email"></p>
        <p>Telephone: <input type="text" size="35" name="Telephone"><br>
          <input type="checkbox" name="DoNotCall" onclick="EnableDisable(this);"> Please do not call me.</p>
        <p>Date of Birth: <input type="text" size="35" name="DateofBirth"></p>
        <p>RoomType
          <select type="text" value="" name="RoomType">
             <option>  </option>
             <option>Single</option>
             <option>Twin</option>
             <option>Double</option>
             <option>Triple</option>
             <option>Family</option>
            </select></p>
        <p>Date of Arrival: <input type="text" size="35" name="DateofArrival"></p>
        <p>Check Out Date: <input type="text" size="35" name="CheckOutDate"></p>
        <p>Number Of Guests
          <select type="text" value="" name="RoomType">
             <option>   </option>
             <option> 1 </option>
             <option> 2 </option>
             <option> 3 </option>
             <option> 4 </option>
            </select></p>
        <p><input type="submit" value="Send" name="submit">
          <input type="reset" value="Reset" name="reset"></p>
      </form>
    </div>
  </th>
  <th scope="col" class="booking2">
    <div class="Login">
      <form method="post">
        <p>Username: <input type="text" size="65" name="username"></p>
        <p>Password: <input type="text" size="65" name="password"></p>
        <p><input type="submit" value="Send" name="submit">
          <input type="reset" value="Reset" name="reset"></p>
      </form>
    </div>
  </th>
</table>
</body>

<!-- Footer Start -->
<br />
<table class="footer">
  <th scope="col" class="socialmedia1">Social Media Links</th>
  <th scope="col" class="copyright">© Hotel Verdene 2017</th>
  <th scope="col" class="socialmedia2">Social Media Links</th>
</table>
mplungjan
  • 169,008
  • 28
  • 173
  • 236
  • Welcome to Stack Overflow! Please visit the [help], take the [tour] to see what and [ask]. [Do some research](https://stackoverflow.com/search?q=Align+input++css), search for related topics on SO – mplungjan Mar 19 '18 at 13:30
  • Your HTML is invalid. You are missing rows. BUT remove the table. Move the form tags outside the DOV and style the div and fields – mplungjan Mar 19 '18 at 13:32
  • If you don't have any restriction of using CSS libraries, use [Bootstrap](https://getbootstrap.com/). And use classes like col-4, col-6 etc as shown [here](https://getbootstrap.com/docs/4.0/layout/grid/#column-breaks). OR follow instructions to use "form" related classes as shown [here](https://getbootstrap.com/docs/4.0/components/forms/). – learner Mar 19 '18 at 13:36

0 Answers0