不能以这种形式为中心

时间:2017-12-02 17:08:42

标签: html css

我一直在寻找和寻找,我不能把这个问题集中在一起。 帮助将不胜感激。

这是相关的html

.fade-form {
  display: inline-block;
  text-align: center;
  color: #ffffff;
  text-align: center;
  animation-name: opac;
  animation-delay: 1.3s;
}
<div class="fade-form">
		<form action=" C:\wamp64\www\data.php" method="post">
			<label for="platenum ">License Plate</label>
			<input type="text" name="platenum " id="platenum">
			<input type="submit" >
		</form>
	</div>

2 个答案:

答案 0 :(得分:0)

您的HTML本身存在问题,但缺少结束语。我更倾向于使用margin:0 auto;进行居中

&#13;
&#13;
.fade-form{
    display: block;
    text-align: center;
    margin: 0 auto;
    color:#ffffff;
    text-align:center;
    animation-name: opac;
    animation-delay: 1.3s;
}
.push-center {
  margin : 0 auto;
}
&#13;
<div class="fade-form">
    <form class='push-center' action="C:\wamp64\www\data.php" method="post">
        <label for="platenum">License Plate</label>
        <input type="text" name="platenum" id="platenum">
        <input type="submit"/>
    </form>
</div>
&#13;
&#13;
&#13;

答案 1 :(得分:-1)

.fade-form{
    background: pink;
    display: block;
    text-align: center;
    color:#ffffff;
    text-align:center;
    animation-name: opac;
    animation-delay: 1.3s;
}
<div class="fade-form">
    <form action="C:\wamp64\www\data.php" method="post">
        <label for="platenum">License Plate</label>
        <input type="text" name="platenum" id="platenum">
        <input type="submit"/>
    </form>
</div>