文本字段未出现在所需位置

时间:2015-02-02 16:22:43

标签: html css

我想在屏幕右侧显示文本字段。我也使用div标签这样做,但无法根据代码获得输出。虽然相同的代码在我的索引页面中提供了所需的输出,但在我的注册页面中它不起作用。该按钮也显示为"危险按钮"。这是我的代码:

@{
  ViewBag.Title = "Login";
  Layout = "~/Views/Shared/_Layout.cshtml";
}
<style>
  div.scroll {
    overflow-y: hidden;
    overflow-x: hidden;
  }
  div.padding {
    padding-top: 8cm;
  }
  div.padding1 {
    padding-left: 6cm;
  }
</style>
<div class="scroll">
  <h1 style="color:#F4981F; font-family:'Segoe Marker'">Sign Up</h1>
  <div class="padding">
    <div class="row">      
      <div class="col-sm-6 col-md-3 col-md-offset-6">
        <div class="container">
          <form action="/Home/Signup1" method="post">
            <table>
              <tr>
                <td>
                  <label style="font-size:x-large; font-family:'Segoe Print'; font- style:italic; font-weight:bolder; color:#F4981F">Username</label>
                  &nbsp&nbsp&nbsp&nbsp
                <td><input type="text" name="un" size="30" style="height:30px;font-size:medium; border-color:#F4981F; font-weight:bold; font-family:'Segoe Print'">  <br/><br/><br/>
              <tr>
                <td>
                  <label style="font-size:x-large; font-family:'Segoe Print'; font-style:italic; font-weight:bolder; color:#F4981F">Password</label>
                  &nbsp&nbsp&nbsp&nbsp
                <td><input type="password" name="pas" size="30" style="height:30px;font-size:medium; border-color:#F4981F; font-weight:bold; font-family:'Segoe Print'"><br /><br />
            </table>
            <div class="padding1">
              <button class="btn btn-larger btn-warning" type="submit" style ="font-family:'Segoe Print'; height:40px; font-size:large; font-weight:bolder">Signup</button>
            </div>
          </form>
        </div>
      </div>  
    </div>   
  </div>
</div>

请记住,相同的代码在索引页面中工作得很好,但在其他表单中却没有。

1 个答案:

答案 0 :(得分:0)

你的意思是你希望登录控件在右上角吗?检查下面的代码段。您可能希望全屏查看以正确查看。

&#13;
&#13;
div.scroll {
  overflow-y: hidden;
  overflow-x: hidden;
}
div.padding {
  padding-top: 8cm;
}
div.padding1 {
  padding-left: 6cm;
}
.container {
  position: absolute;
  top: 0;
  right: 0;
}
&#13;
<div class="scroll">
  <h1 style="color:#F4981F; font-family:'Segoe Marker'">Sign Up</h1>
  <div class="padding">
    <div class="row">
      <div class="col-sm-6 col-md-3 col-md-offset-6">
        <div class="container">
          <form action="/Home/Signup1" method="post">
            <table>
              <tr>
                <td>
                  <label style="font-size:x-large; font-family:'Segoe Print'; font- style:italic; font-weight:bolder; color:#F4981F">Username</label>
                  &nbsp&nbsp&nbsp&nbsp
                  <td>
                    <input type="text" name="un" size="30" style="height:30px;font-size:medium; border-color:#F4981F; font-weight:bold; font-family:'Segoe Print'">
                    <br/>
                    <br/>
                    <br/>
                    <tr>
                      <td>
                        <label style="font-size:x-large; font-family:'Segoe Print'; font-style:italic; font-weight:bolder; color:#F4981F">Password</label>
                        &nbsp&nbsp&nbsp&nbsp
                        <td>
                          <input type="password" name="pas" size="30" style="height:30px;font-size:medium; border-color:#F4981F; font-weight:bold; font-family:'Segoe Print'">
                          <br />
                          <br />
            </table>
            <div class="padding1">
              <button class="btn btn-larger btn-warning" type="submit" style="font-family:'Segoe Print'; height:40px; font-size:large; font-weight:bolder">Signup</button>
            </div>
          </form>
        </div>
      </div>
    </div>
  </div>
</div>
&#13;
&#13;
&#13;