当选项大于屏幕大小时,ios7不会显示超过一行

时间:2021-08-14 21:12:55

iOS 7 does not show more than one line in html options:

ios7在html选项中显示不超过一行:

<select>
  <option value="volvo">Volvo test test test test test test </option>
  <option value="saab">Saab</option>
  <option value="opel">Opel</option>
  <option value="audi">Audi</option>
</select>

It just truncates it with ellipsis. Has anyone else noticed this with just a standard HTML option?

它只是用省略号截断它。有没有人注意到只有一个标准的HTML选项?

Perhaps it is an iOS 7 bug because it was not happening on iOS6? I pulled this directly from the w3schools site.

也许是iOS6上没有出现iOS 7的错误?我直接从w3schools网站上下载了这个。

To reproduce, take your iPhone running iOS 7 and go to this jsFiddle.

要复制,请使用运行iOS 7的iPhone并访问jsFiddle。

Obviously you can see the question once selected. But with a mobile optimized phone you will not see the entire question.

显然,您可以看到问题一旦选定。但是,如果使用移动优化的手机,你将看不到整个问题。

Unless I am missing something here.

除非我漏掉了什么。

2 个解决方案

#1


8  

Add an empty optgroup at the end of the select list:

在选择列表的末尾添加一个空的optgroup:

 <select>
  <option selected="" disabled="">Select a value</option>
  <option>Grumpy wizards make toxic brew for the evil Queen and Jack</option>
  <option>Quirky spud boys can jam after zapping five worthy Polysixes</option>
  <option>The wizard quickly jinxed the gnomes before they vaporized</option>
  <option>All questions asked by five watched experts amaze the judge</option>
  <optgroup label=""></optgroup>
 </select>

#2


1  

Looks like it now requires the <optgroup> standard to wrap the options.

看起来现在需要标准来包装选项。

Problem solved.

问题解决了。

#1


8  

Add an empty optgroup at the end of the select list:

在选择列表的末尾添加一个空的optgroup:

 <select>
  <option selected="" disabled="">Select a value</option>
  <option>Grumpy wizards make toxic brew for the evil Queen and Jack</option>
  <option>Quirky spud boys can jam after zapping five worthy Polysixes</option>
  <option>The wizard quickly jinxed the gnomes before they vaporized</option>
  <option>All questions asked by five watched experts amaze the judge</option>
  <optgroup label=""></optgroup>
 </select>

#2


1  

Looks like it now requires the <optgroup> standard to wrap the options.

看起来现在需要标准来包装选项。

Problem solved.

问题解决了。