如何将表单与背景中心对齐? CSS

时间:2016-05-01 01:32:13

标签: css

我有以下表格:https://nmap.org/

使用这个CSS:

#myForm {
    margin: auto;
    width: 600px;
}
#myForm form {
    background-color: #E0E0E0;
    text-align: center;
    padding: 5px;
}
#myForm table {
    text-align: left;
}

这是一个jsfiddle链接:http://imgur.com/8uV4729

如何对齐表格表以使其位于屏幕中间和灰色背景中?我怎样才能在表单和提交/重置按钮之间放置一行空格?

1 个答案:

答案 0 :(得分:0)

enter image description here该表将占用指定的宽度,剩余的空间将在两个边距之间平均分配

table{
    margin: auto;
    width: 53%;
    border: 3px solid #73AD21;
    padding: 15px;
}

我还会从地址输入

中移除大小attr
<input type="text" id="homeaddress" name="homeaddress"  />

我在这里更新你的jsfiddle https://jsfiddle.net/s3mcrk39/8/

相关问题