如何设置与标签相对应的表单的输入字段?

时间:2016-10-14 17:33:45

标签: html css twitter-bootstrap

这是我的html部分

  <html>
   <head>
   <title>Signin</title>
    <link href="login1.css" rel="stylesheet">
    <link href="css/bootstrap.min.css" rel="stylesheet">
       link href="css/bootstrap-theme.min.css" rel="stylesheet">

    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
    <![endif]-->
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
    <!-- Include all compiled plugins (below), or include individual files as needed -->
    <script src="js/bootstrap.min.js"></script>
   </head>
   <body>
        <div style="padding:20px"></div>
        <div class="container">
        <div class="row">
        <div class="col-xs-12 col-sm-6"><img src="comp.png"/></div>
        <div id="form1" class="col-xs-12 col-sm-6">
          <form action="" method="post" enctype="multipart" id="fieldset">
        <label>Username:</label><input type="text" name="name" placeholder="enter name" /><br>
        <label>Year:</label><input type="year" name="year" id="year" size="5" required><br>
        <label  for="gender" >Gender:</label>
        male<input type="radio" value="male" name="gender" id="gender"/>female<input type="radio" name="gender" value="female"id="gender"><br>
        <label>Branch:</label><input type="branch" name="branch" id="branch" size="10" required><br>
        <label>Password:</label><input type="password" /><br>
        <label>Confirm Password:</label><input type="password" name="name" required><br>
        <label>Mobilenumber:</label><input type="number" name="mobilenumber"><br>
        <label>Email_ID:</label><input type="text" name="mail_id" required><br>
        <label>Date of Birth:</label>
        <input type='date' name='dob' id="dob" required><br>
        <div style="padding:15px"></div>
        <input type="submit" value="Submit" id="button">
        <p id="text">if already registered<a href="login.html">click here</a>to login</p>
    </form>
    </div>
    </div>
    </div>
   </body>

</html>

和css部分是

img
{
    max-width: 100%;
}   
label
{
    width:300px;
    text-align: right;
    float:left;
    margin-top:12px;
}
input
{
    margin-top: 12px;
}

0 个答案:

没有答案