如何使用水平对齐的选项创建选择输入?

发布于 2025-02-10 05:34:04 字数 279 浏览 3 评论 0原文

我基本上想创建一个选择元素,其中选项 彼此相邻显示。像这样:

我该如何实现此设计?

I basically want to create a select element, where the options are displayed next to each other horizontally. Like this:
enter image description here

How can I implement this design?

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

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

发布评论

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

评论(1

轮廓§ 2025-02-17 05:34:04

使用基本形式的单个按钮是一种方法,然后使用CSS隐藏实际输入,同时保持标签

保持其功能的同时

然后,您只是在设计标签,

 <form action="form action goes here">
   <input type="radio" value="1">
   <label for="1">1</label> 
   <input type="radio" value="2">
   <label for="2">2</label> 
   <input type="radio" value="3">
   <label for="3">3</label> 
   <input type="radio" value="1">
   <label for="3">3</label> 
...and so on
</form>

Using a basic form a radio button would be one way to do it and then hide the actual input using css while keeping the label

Hide radio button while keeping its functionality

then you are just styling the labels how you want them

 <form action="form action goes here">
   <input type="radio" value="1">
   <label for="1">1</label> 
   <input type="radio" value="2">
   <label for="2">2</label> 
   <input type="radio" value="3">
   <label for="3">3</label> 
   <input type="radio" value="1">
   <label for="3">3</label> 
...and so on
</form>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文