html - 表格居中对齐

标签 html css

<分区>

我一直在阅读关于 stackoverflow 和其他的所有各种帖子,但我仍然面临一个问题。请不要将其复制。

即使我使用 float:center/middle;position 等,我也无法对齐表单 id="clientLogin" 但可以获得成功。请解决我的问题,或者如果我做任何错误以防万一请更新。 提前致谢! Screenshot of image

CSS 文件:https://pastebin.com/Pqvu0s9h

  <div id="content">
        
         <h1>Check Ticket Status</h1>
<p>To view the status of a ticket, provide us with the login details below.</p>
<form action="login.php" method="post" id="clientLogin">
    <strong></strong>
    <br>
    <div>
        <label for="email">E-Mail Address:</label>
        <input id="email" type="text" name="lemail" size="30" value="">
    </div>
    <div>
        <label for="ticketno">Ticket ID:</label>
        <input id="ticketno" type="text" name="lticket" size="30" value=""></td>
    </div>
    <p>
        <input class="btn" type="submit" value="View Status">
    </p>
    </form>
<br>
<p>
If this is your first time contacting us or you've lost the ticket ID, please <a href="home.php">open a new ticket</a>.    
</p>
        </div>
        
        

    </div>

最佳答案

像这样更改选择器 #clientLogin 的 css。您需要删除属性 position: absolute;

#clientLogin {
  width: 400px;
  margin-top: 20px;
  padding: 10px 100px 10px 10px;
  border: 1px solid #ccc;
  background: url('/assets/copyright-shiv/images/lock.png?1319655200') 440px 50% no-repeat #FCF5E9;
  margin-left: auto;
  margin-right: auto;
}

关于html - 表格居中对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50587372/

上一篇:javascript - Font Awesome CSS 伪元素

下一篇:html - 当屏幕变小时,bootstrap col 调整大小

相关文章:

javascript - 将选项值放入输入文本中

html - 大型菜单超出窗口

javascript - 在旋转的 div 上缩放时计算新的左侧和顶部

html - 将文本限制为容器宽度并保持居中样式

javascript - 使 django 的消息出现在 Javascript 警报而不是 html 中?

css - 为什么 <head> 中有 'This is not a zero-length file'

css - vimeo 全窗口大小嵌入

css - 如何使用 bootstrap 重现现有的 html 设计

php - Wordpress 上的特色图片

jQuery 将元素拖动到初始状态为隐藏的可排序列表中