我有一个工作转盘,它包含一个表单和3个图像,我希望转盘比它大(我想如果我没有定义高度和宽度,它将是图像的大小,但这没有起作用),我希望表单出现在转盘的中心,此时它在左边,尽管我有float:center,但我也尝试了填充,但似乎什么都不起作用。我在下面附上了我的代码,有人能给我建议吗?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>
要使表单居中,您必须设置宽度,边距为左:自动,边距为右:自动
<div class="span8" style="width: 500px; margin-right: auto; margin-left: auto;">
<!-- your form goes here -->
</div>