gpt4 book ai didi

HTML CSS 调整大小问题 - 按钮和复选框向下一行

转载 作者:太空宇宙 更新时间:2023-11-03 22:04:18 25 4
gpt4 key购买 nike

我的 html 按钮和复选框有问题。每当我调整页面大小时,特别是使其非常小时,我的按钮和复选框都会位于底部。您可以通过运行我的代码来检查它。我希望按钮和复选框与文本框保持在同一行。请帮忙。提前致谢。

compresstest.html

<html>
<head>
<style type="text/css">
table#tblTest {
width: 100%;
margin-top: 10px;
font-family: verdana,arial,sans-serif;
font-size:12px;
color:#333333;
border-width: 1px;
border-color: #666666;
border-collapse: collapse;
}

table#tblTest th {
white-space: nowrap;
border-width: 1px;
padding: 8px;
border-style: solid;
border-color: #666666;
background-color: #dedede;
}

table#tblTest td {
border-width: 1px;
padding: 8px;
border-style: solid;
border-color: #666666;
background-color: #ffffff;
}
</style>
</head>

<body>
<div style="width: 100%;">
<input type="text" id="searchCompanyText" name="searchCompanyText" />
<input type="button" id="searchCompanyBtn" name="searchCompanyBtn" value="Search" onclick="searchCompany ();"/>
<input type="checkbox" id="isActive" name="isActive" checked="checked" /> Active
</div>

<table id="tblTest" style="width: 100%">
<tr>
<th>Name</th>
<th>Address</th>
</tr>
<tr>
<td>Tom</td>
<td>UK </td>
</tr>

<tr>
<td>Hans</td>
<td>Germany</td>
</tr>
<tr>
<td>Henrik</td>
<td>Denmark</td>
</tr>
<tr>
<td>Lionel</td>
<td>Italy</td>
</tr>
<tr>
<td>Ricardo</td>
<td>Brazil</td>
</tr>
<tr>
<td>Cristiano</td>
<td>Portugal</td>
</tr>
</table>
</body>
</html>

最佳答案

你也可以使用 white-space: nowrap;在你的 div 上。

https://developer.mozilla.org/en/CSS/white-space

关于HTML CSS 调整大小问题 - 按钮和复选框向下一行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7900492/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com