英文:
reactjs - horizontal scroll bar fails to show when content is a group of buttons
问题
I'm running Next.js v13.1.1 & react 18.2.0.
and I'm unable to add a horizontal scroll bar to a div that has buttons for content.
this does not seem to be a browser issue ( standard html renders as expected )
this also does not happen (in react.js/next.js) when the div's content is simple text.
in other words:
- div's content is text -> works as expected ( the horizontal scrollbar is shown ):
div style={{width: "100px", height: "30px", overflowX: "auto", overflowY: "hidden"}}>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
..../div...
- when div's content is a group of buttons -> the horizontal scrollbar is not shown:
...div style={{width: "100px", height: "30px", overflowX: "auto", overflowY: "hidden"}}...
...input type="button" value="omer1"/...
...input type="button" value="omer2"/...
...input type="button" value="omer3"/...
.
.
.
.../div...
note that this if for the exact same inline style.
this is for both firefox 58.0.2 & chrome 80.0.3987.132.
- i am able to show a vertical scrollbar for buttons with
style={{width: "100px", height: "30px", overflowX: "hidden", overflowY: "auto"}}
and
style={{width: "100px", height: "30px", overflow: "auto"}}
but this is not what I wish to do
( sorry i wasn't able to display the code properly, I only managed to show the code by replacing '<' and '>' with '...' )
any help would be appreciated
英文:
I'm running Next.js v13.1.1 & react 18.2.0.
and I'm unable to add a horizontal scroll bar to a div that has buttons for content.
this does not seem to be a browser issue ( standard html renders as expected )
this also does not happen (in react.js/next.js) when the div's content is simple text.
in other words :
- div's content is text -> works as expected ( the horizontal scrollbar is shown ):
div style={{width:"100px",height:"30px",overflowX: "auto",overflowY: "hidden"}}>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
..../div...
- when div's content is a group of buttons -> the horizontal scrollbar is not shown :
...div style={{width:"100px",height:"30px",overflowX: "auto",overflowY:"hidden"}}...
...input type="button" value="omer1"/...
...input type="button" value="omer2"/...
...input type="button" value="omer3"/...
.
.
.
.../div...
note that this if for the exact same inline style.
this is for both firefox 58.0.2 & chrome 80.0.3987.132.
- i am able to show a vertical scrollbar for buttons with
style={{width:"100px",height:"30px",overflowX: "hidden",overflowY:"auto"}}
and
style={{width:"100px",height:"30px",overflow:"auto"}}
but this is not what I wish to do
( sorry i wasn't able to diplay the code properly, I only manged to show the code by replacing '<' and '>' with '...' )
any help would be appreciated
答案1
得分: 0
这是要翻译的内容:
I wanted this to be a comment, But I'm restricted.
I'd like to know, do the buttons sit on one line, or are they on top of each other?
For scrollbars, you'll need to provide a fixed width or height. So Please try adding a fixed width to the parents let's see.
英文:
I wanted this to be a comment, But I'm restricted.
I'd like to know, do the buttons sit on one line, or are they on top of each other?
For scrollbars, you'll need to provide a fixed width or height. So Please try adding a fixed width to the parents let's see.
答案2
得分: 0
已将其与以下内联样式配合使用:
style={{width:"100px",overflow: "auto",whiteSpace: "nowrap"}}
英文:
made it work with the following inline
style={{width:"100px",overflow: "auto",whiteSpace: "nowrap"}}
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论