如何使标签字段和文本字段出现在asp.net mvc4中的同一行?

时间:2015-11-19 03:18:23

标签: asp.net-mvc-4

 @using (Html.BeginForm()) {
<div>
<fieldset>
    <legend>Form</legend>
 <label for="FirstName">First Name:</label>
  <input type="text" name="FirstName">

 <label for="LastName">Last Name:</label>
  <input type="text" name="LastName">
<label for="Period">Date:</label>
<input type="text" name="Period">
 <p>
        <input type="submit" value="   Send   " />
    </p>
</fieldset>
</div>
}

这里我想让所有标签字段和文本字段显示在同一行上?我怎么能这样做?

1 个答案:

答案 0 :(得分:0)

将父Div和段落显示样式更改为内联

<div style="display:inline">
<fieldset>
<legend>Form</legend>
<label for="FirstName">First Name:</label>
<input type="text" name="FirstName">
<label for="LastName">Last Name:</label>
<input type="text" name="LastName">
<label for="Period">Date:</label>
<input type="text" name="Period">
<p style="display:inline">
    <input type="submit" value="   Send   " />
</p>
</fieldset>
</div>