将表单集中在旋转木马引导程序php中

时间:2015-04-03 12:24:34

标签: php forms twitter-bootstrap carousel

我有一个工作的旋转木马,包含一个表格和3个图像,我希望旋转木马比它更大(我想如果我没有定义高度和宽度,它将是图像的大小,但这没有工作),我希望表单出现在旋转木马的中心,在它左边的那一刻,即使我有浮动:中心我也尝试了填充,但似乎没有任何工作。我在下面附上了我的代码,任何人都可以给我建议1)如何将表单定位到旋转木马中我想要的位置 2)如何使旋转木马成为图像的大小或大于它的分钟。 任何帮助将不胜感激......

<style>
  .carousel-inner > .item > img,
  .carousel-inner > .item > a > img {
  margin: auto;
}

</style>
</head> 
<body>


<br>
<div id="myCarousel" class="carousel slide" data-ride="carousel"   >
 <!-- Indicators -->
<ol class="carousel-indicators">
  <li data-target="#myCarousel" data-slide-to="0" class="active"></li>
  <li data-target="#myCarousel" data-slide-to="1"></li>
  <li data-target="#myCarousel" data-slide-to="2"></li>
  <li data-target="#myCarousel" data-slide-to="3"></li>
</ol>

<!-- Wrapper for slides -->
<div class="carousel-inner" role="listbox">
  <div class="item active">
        <div class="span8" style="float:center; margin:0px, 0px, 0px, 20px;">
<form role="form" name="login" action="login.php" method="POST" style="align-center" >
Username<br><input type="text" name="Username" /></br>
Password<br><input type="password" name="Password" /></br>
<br><input type="submit" value="Login" name="login" />
<br>
<br>
<br>
</form>
</div>
  </div>

  <div class="item">
    <img src="UUJ.jpg" alt="UUJ">
  </div>

  <div class="item">
    <img src="UU2.jpg" alt="UU2">
  </div>

  <div class="item">
    <img src="UU3.jpg" alt="UU3">
  </div>
</div>

<!-- Left and right controls -->
<a class="left carousel-control" href="#myCarousel" role="button" data-slide="prev">
  <span class="glyphicon glyphicon-chevron-left" aria-hidden="true"></span>
  <span class="sr-only">Previous</span>
</a>
<a class="right carousel-control" href="#myCarousel" role="button" data-slide="next">
  <span class="glyphicon glyphicon-chevron-right" aria-hidden="true"></span>
  <span class="sr-only">Next</span>
</a>

   

   

1 个答案:

答案 0 :(得分:0)

要使窗体居中,请设置宽度为margin-left:auto和margin-right:auto

<div class="span8" style="width: 500px; margin-right: auto; margin-left: auto;">
  <!-- your form goes here -->
</div>