iOS 7 doesn't show more than one line when option is longer than screen size

主宰稳场 提交于 2019-12-07 10:05:46

问题


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

<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?

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

To reproduce, take your iPhone running iOS 7 and go to this 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.


回答1:


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

 <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:


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

Problem solved.



来源:https://stackoverflow.com/questions/19011978/ios-7-doesnt-show-more-than-one-line-when-option-is-longer-than-screen-size

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!