Tuesday 15 February 2011

css - Select box html horizontal scroll -


I want to use the selection box and when overflow occurs, then scrolls in the selection box

css

  #selectbox {width: 100%; Overflow: scroll; }   

HTML

  & lt; Div style = "width: 140px;" & Gt; & Lt; Select name = "selection box" size = "5" id = "selectbox" & gt; & Lt; Option value = "1" & gt; One two three four five six & lt; / Options & gt; & Lt; Option value = "2" & gt; Seven eight & lt; / Options & gt; & Lt; Option value = "3" & gt; Nine & lt; / Options & gt; & Lt; Option value = "1" & gt; One two three four five six & lt; / Options & gt; & Lt; Option value = "2" & gt; Seven eight & lt; / Options & gt; & Lt; Option value = "3" & gt; Nine & lt; / Options & gt; & Lt; Option value = "1" & gt; One two three four five six & lt; / Options & gt; & Lt; Option value = "2" & gt; Seven eight & lt; / Options & gt; & Lt; Option value = "3" & gt; Nine & lt; / Options & gt; & Lt; Option value = "1" & gt; One two three four five six & lt; / Options & gt; & Lt; Option value = "2" & gt; Seven eight & lt; / Options & gt; & Lt; Option value = "3" & gt; Nine & lt; / Options & gt; & Lt; / Select & gt; & Lt; / Div & gt;   

But just show vertical scrolls. How can this problem be solved?

To quickly see these changes: See

These changes are:

  1. First look at what I changed the CSS from the box selection box. This is because we want to allow scrolling on our div rather than selectboxes.
  2. Use

      overflow - x: auto; Overflow-y: auto;    
  3. To set the width for the div to see scrolling at work.

  4. The width is removed here, because it resists the previous definition

    to view the action demo: < / Html> view

No comments:

Post a Comment