我有一个带有2个项目的单元格的表格(输入文字和图像)。我尝试垂直对齐它们但它不起作用。
我尝试使用vertical-align:middle
,上边距,填充,尝试设置高度:100%等等...
代码很简单:
<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>
这里有一个问题的例子:https://jsfiddle.net/javierif/nmpmj1eh/
答案 0 :(得分:3)
将vertical-align: middle
添加到.campoOpcional input
并且它有效 - 请参阅下面的演示:
.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>
答案 1 :(得分:0)
使用此代码,
需要Sub AllocateDepartmentData()
Dim prevRow As Long
Dim deptRow As Long
Dim deptNum As Variant
Dim destSheet As String
Dim destRow As Long
prevRow = 0
'Find the end of the first section
deptRow = Range("A:A").Find(What:="Department", LookIn:=xlValues, LookAt:=xlPart).Row
Do While deptRow > prevRow
'Parse the cell containing the department number/name to get just the number
deptNum = Cells(deptRow, 1).Value
deptNum = Mid(deptNum, InStr(deptNum, " ") + 1)
deptNum = CInt(Left(deptNum, InStr(deptNum & " ", " ") - 1))
'Based on the department number, determine the destination sheet
Select Case deptNum
'One "Case" statement should be set for each destination sheet name
Case 1, 2, 60, 61, 63
destSheet = "Amanda"
'Add more "Case" statements for each sheet
Case 73, 74
destSheet = "Shannon"
'And finally catch any departments that haven't been allocated to a sheet
Case Else
MsgBox "Department " & deptNum & " has not been allocated to anyone!"
End
End Select
With Worksheets(destSheet)
'Work out which row to copy to
destRow = .Cells(.Rows.Count, "A").End(xlUp).Row + 1
'destRow will be 2 if the sheet was currently empty, so adjust to be 1 instead
If destRow = 2 Then destRow = 1
'Copy everything from the end of the previous section to the end of this section
Rows((prevRow + 1) & ":" & deptRow).Copy Destination:=.Range("A" & destRow)
End With
'Set up for next section
prevRow = deptRow
deptRow = Range("A:A").FindNext(Cells(deptRow, "A")).Row
'The loop will stop once the newly found "Department" is on a row before the last processed section
Loop
End Sub
的input
内的 campoOpcional
vertical-align