2

I have a table with a cell with 2 items (input text and image). I try to align them vertically but it does not work.

I try use vertical-align:middle, margin top, padding, try set height:100%, etc...

The code is simply:

<table cellspacing="0" rules="all" border="1" id="Origen" style="width:100%;border-collapse:collapse;">
            <tr>
                <td class="cabeceraDG"> Origen</td><td class="cabeceraDG"> Centro</td><td class="cabeceraDG"> Usuario</td>
            </tr><tr style="white-space:nowrap;">
                <td class="campoOpcional">oficina</td><td class="campoOpcional" align="center" style="width:150px;">
                                <input name="Origen$ctl02$referenciaTextBox" type="text" value="0000" id="Origen_ctl02_referenciaTextBox" class="campoOpcional" onblur="return validate(this)" ref="0991" />
 <input type="image" name="Origen$ctl02$imgBtnGuardarCentro" id="Origen_ctl02_imgBtnGuardarCentro" title="Guardar" AutoPostBack="false" src="https://s30.postimg.org/usmf6nsn5/boton_Abonar.gif" onclick="return ASPxClientEdit.ValidateGroup();  msGuardar();" style="border-width:0px;" />
                             </td><td class="campoOpcional">TEST</td>
            </tr>
        </table>

And here an example with the problem: https://jsfiddle.net/javierif/nmpmj1eh/

2 Answers 2

3

Add vertical-align: middle to .campoOpcional input and it works - see demo below:

.campoOpcional input {
  vertical-align: middle;
}
<table cellspacing="0" rules="all" border="1" id="Origen" style="width:100%;border-collapse:collapse;">
  <tr>
    <td class="cabeceraDG">Origen</td>
    <td class="cabeceraDG">Centro</td>
    <td class="cabeceraDG">Usuario</td>
  </tr>
  <tr style="white-space:nowrap;">
    <td class="campoOpcional">oficina</td>
    <td class="campoOpcional" align="center" style="width:150px;">
      <input name="Origen$ctl02$referenciaTextBox" type="text" value="0000" id="Origen_ctl02_referenciaTextBox" class="campoOpcional" onblur="return validate(this)" ref="0991" />
      <input type="image" name="Origen$ctl02$imgBtnGuardarCentro" id="Origen_ctl02_imgBtnGuardarCentro" title="Guardar" AutoPostBack="false" src="https://s30.postimg.org/usmf6nsn5/boton_Abonar.gif" onclick="return ASPxClientEdit.ValidateGroup();  msGuardar();"
      style="border-width:0px;" />
    </td>
    <td class="campoOpcional">TEST</td>
  </tr>
</table>

Sign up to request clarification or add additional context in comments.

Comments

0

Use this code,

input inside the campoOpcional needed vertical-align

.campoOpcional input {
  vertical-align: middle;
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.