I have the following form:
.table {
max-width: 500px;
border-collapse: collapse;
font-size: 12;
width: 320px;
text-align: center;
box-shadow: 2px 2px 2px 2px #aaa;
}
.table tr td{
padding: 8px 8px 8px 8px;
}
.campo {
border: 1px double black;
}
#teste {
overflow: auto;
max-height: 500px;
max-width: 18ç0px;
position:absolute;
z-index:999;
left:0%;
top:0%;
background-color:#fff;
border:1px solid #000;
padding:6px;
}
#teste2 {
overflow: auto;
max-height: 500px;
max-width: 300px;
position:absolute;
z-index:999;
right:0%;
top:0%;
background-color:#fff;
border:1px solid #000;
padding:6px;
}
<div id="teste">
<form id="form1" name="form1" method="post" action="#">
<input type="button" onclick="ver()" value="x">
<div id="div1" style="display: none;"></div>
</form>
</div>
<center>
<h1>x</h1>
</center>
<form id="form2" name="form2" method="post" action="#">
<center>
<table class="table">
<tr>
<td class="campo">
<span id="inf1">*x</span><br/>
<input type="text" id="txt" name="txt" size="2"/><br/>
<span id="inf2">x?</span><br/>
<input type="text" id="txt2" name="txt2" size="2"/><br/>
x?
<input type="checkbox" id="ckb" name="ckb" /><br/><br/>
<input type="button" value="x" onclick="setaInf();">
</td>
</tr>
</table>
<br/>
<span id="inf3"><small>*x</small></span>
</center>
</form>
<div id="teste2">
<form id="form3" name="form3" method="post" action="#">
<input type="button" onclick="ver()" value="x">
<div id="lol1" style="display: none;"></div>
</form>
</div>
<br/><br/><br/>
<center>
<div>
<form id="form4" name="form4" method="post" action="#">
<div id="lol" style="display: none;"></div>
</form>
</div>
</center>
I know that the <center>
tag has been deprecated and, according to references, the correct one would now be to use the css
text-align:center;
attribute but even then I can not reproduce the same effect, see example below:
.table {
max-width: 500px;
border-collapse: collapse;
font-size: 12;
width: 320px;
text-align: center;
box-shadow: 2px 2px 2px 2px #aaa;
}
.table tr td{
padding: 8px 8px 8px 8px;
}
.campo {
border: 1px double black;
}
#teste {
overflow: auto;
max-height: 500px;
max-width: 18ç0px;
position:absolute;
z-index:999;
left:0%;
top:0%;
background-color:#fff;
border:1px solid #000;
padding:6px;
}
#teste2 {
overflow: auto;
max-height: 500px;
max-width: 300px;
position:absolute;
z-index:999;
right:0%;
top:0%;
background-color:#fff;
border:1px solid #000;
padding:6px;
}
<div id="teste">
<form id="form1" name="form1" method="post" action="#">
<input type="button" onclick="ver()" value="x">
<div id="div1" style="display: none;"></div>
</form>
</div>
<div style='text-align:center;'>
<h1>x</h1>
<form id="form2" name="form2" method="post" action="#">
<table class="table">
<tr>
<td class="campo">
<span id="inf1">*x</span><br/>
<input type="text" id="txt" name="txt" size="2"/><br/>
<span id="inf2">x?</span><br/>
<input type="text" id="txt2" name="txt2" size="2"/><br/>
x?
<input type="checkbox" id="ckb" name="ckb" /><br/><br/>
<input type="button" value="x" onclick="setaInf();">
</td>
</tr>
</table>
<br/>
<span id="inf3"><small>*x</small></span>
</form>
</div>
<div id="teste2">
<form id="form3" name="form3" method="post" action="#">
<input type="button" onclick="ver()" value="x">
<div id="lol1" style="display: none;"></div>
</form>
</div>
<br/><br/><br/><br/><br/><br/>
<div style='text-align:center;'>
<form id="form4" name="form4" method="post" action="#">
<div id="lol" style="display: none;"></div>
</form>
</div>
How do I centralize the two div´s
of the first example without having to use the <center>
tag?