html - Html复选框输入大小错误
问题描述
当前显示 我在一个 asp.net 网站上工作,我需要输入文本和复选框。我目前的解决方案如下:
<form method="post" style="width:100%">
<table style="padding:5px; width:100%">
<tr>
<td style="white-space:nowrap; width:1%">Printer name:</td>
<td><input type="text" name="PrinterName" value="@Request["PrinterName"]" style="max-width:100%; width:100%" /></td>
</tr>
<tr>
<td style="white-space:nowrap">Model:</td>
<td><input type="text" name="Model" value="@Request["Model"]" style="max-width:100%; width:100%" /></td>
</tr>
<tr>
<td style="white-space:nowrap">Location:</td>
<td><input type="text" name="Location" value="@Request[" Location"]" style="max-width:100%; width:100%" /></td>
</tr>
<tr>
<td style="white-space:nowrap">IP:</td>
<td>
<table style="margin:0px; padding:0px">
<tr>
<td style="padding:0px"><input type="text" name="IP" value="@Request["IP"]" style="max-width:100%; width:100%" /></td>
<td style="white-space:nowrap;width:1%">
<div><input style="margin:0px; padding:0px" type="checkbox" />QuickIP</div>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td style="white-space:nowrap">MAC(XX-XX-XX-XX-XX-XX):</td>
<td><input type="text" name="MAC" value="@Request["MAC"]" style="max-width:100%; width:100%" /></td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="Submit" class="Sumbit" style="max-width:100%; width:100%" /></td>
</tr>
</table>
</form>
该复选框未报告正确的大小(IE 和 Chrome),文本也未保留在空间内。
目的是将文本直接放在复选框旁边,并且在文本输入右侧尽可能小地排列。如果没有这个奇怪的错误,我将如何实现?
编辑:在我的测试中,我切换了文本框和按钮,并在复选框的样式中添加了高度,现在已经更正了
Edit2:添加了现在显示的图片
解决方案
看来你只需height: 1%
要从
<td style="white-space:nowrap;width:1%">
<!-- remove the height from the style below -->
<div><input style="margin:0px; padding:0px; height:1%" type="checkbox" />QuickIP</div>
</td>
这将呈现“QuickIP”文本旁边的复选框
看看这个 codepen。
推荐阅读
- xcode - Xcode 助手“迅速”消耗大量内存
- windows - 在 SFTP 批处理文件中包含密码
- android - 新频道默认禁用通知声音
- c# - 如何从 xamarin 中的条目中读取 int 值?
- react-native - 阻止用户在 React Native 中成功登录后返回登录屏幕
- php - Pusher 中的未知 auth_key - Laravel 6.2
- java - 如果数组值等于某事,则执行一些 Android 功能
- prometheus - blackbox exporter ssh 连接测试问题
- php - 结合两个 PHP 数组匹配列 deposit 和 date
- xtext - 如何在 Eclipse 编辑器中确定我的语言的关键字所属行的索引?