html - 'Select' form element breaks my site's responsive layout -
i'm trying make site mobile-friendly using responsive layout, select controls in forms break it, exceeding beyond screen width wherever contain long option item.
what correct way deal form elements?
you can use max-width limit size of <select>. idea give selects max-width: 100%; text-overflow: ellipsis;
max-width limit size of parent's width , if option overflows, text truncated neat ellipsis in nice browsers , cut in middle in other ones.
after clicking select, option list appears. list can wider in standard desktop browser, it's size doesn't count body size, won't mangle layout. on mobile, won't problem since mobile browsers display option lists differently.
Comments
Post a Comment