HTML 表单控制换行符

发布于 2024-10-08 20:23:38 字数 2072 浏览 1 评论 0原文

有没有办法在 HTML 中的表单控件中强制换行。我使用的是下拉菜单,有些选项占用了太多空间。如果可能的话,我想将它们分成多行。有什么想法吗?

编辑: 以下是有问题的菜单的代码:

<select name="Select1" multiple="multiple">
                    <option selected="selected">(Any)</option>
                    <option>Acadia National Park</option>
                    <option>Alaska Railroad</option>
                    <option>Arapho-Roosevelt<br/>National Forest</option>
                    <option>BLM</option>
                    <option>Cades Cove Heritage Tours</option>
                    <option>Cape Cod Commission</option>
                    <option>Cape Cod National Seashore</option>
                    <option>Cape Cod Regional Transit Authority</option>
                    <option>City of Baltimore DOT</option>
                    <option>City of Commerce City</option>
                    <option>City of Flagstaff</option>
                    <option>City of Jacksonville</option>
                    <option>City of Lowell, MA</option>
                    <option>City of New Bedford, Office of Planning</option>
                    <option>City of Augustine, FL</option>
                    <option>City of The Dalles</option>
                    <option>City of Visalia</option>
                    <option>Codevisa Transit with Municipality of San Juan
                    </option>
                    <option>Colonial National Historical Park</option>
                    <option>Cuyahoga Valley National Park</option>
                    <option>Cuyahoga Valley Scenic Railroad</option>
                    <option>Delaware Water Gap National Recreation Area
                    </option>
                    <option>Denali National Park and Preserve</option>
                    </select>

Is there a way to force a line break in a form control in HTML. I'm using drop-down menus, and some of the choices are taking up a little too much space. I'd like to break them into multiple lines if possible. Any ideas?

Edit:
Heres the code for the problematic menu:

<select name="Select1" multiple="multiple">
                    <option selected="selected">(Any)</option>
                    <option>Acadia National Park</option>
                    <option>Alaska Railroad</option>
                    <option>Arapho-Roosevelt<br/>National Forest</option>
                    <option>BLM</option>
                    <option>Cades Cove Heritage Tours</option>
                    <option>Cape Cod Commission</option>
                    <option>Cape Cod National Seashore</option>
                    <option>Cape Cod Regional Transit Authority</option>
                    <option>City of Baltimore DOT</option>
                    <option>City of Commerce City</option>
                    <option>City of Flagstaff</option>
                    <option>City of Jacksonville</option>
                    <option>City of Lowell, MA</option>
                    <option>City of New Bedford, Office of Planning</option>
                    <option>City of Augustine, FL</option>
                    <option>City of The Dalles</option>
                    <option>City of Visalia</option>
                    <option>Codevisa Transit with Municipality of San Juan
                    </option>
                    <option>Colonial National Historical Park</option>
                    <option>Cuyahoga Valley National Park</option>
                    <option>Cuyahoga Valley Scenic Railroad</option>
                    <option>Delaware Water Gap National Recreation Area
                    </option>
                    <option>Denali National Park and Preserve</option>
                    </select>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

熊抱啵儿 2024-10-15 20:23:38

尝试更改下拉菜单的宽度。您可以发布您当前拥有的代码吗?

Try changing the width of the drop-down menu. Can you post the code you currently have?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文