简体   繁体   English

如何在最大缩放时停止表格溢出外部 div

[英]How to stop table overflowing outer div on max zoom

Having some CSS issues.有一些 CSS 问题。 I want to keep the Pagination component in a fixed position no matter if the table shrinks in height.无论表格的高度是否缩小,我都想将分页组件保持在固定的 position 中。 When zooming all the way in to the page, the Pagination component will make its way over the top of the table.当一直放大到页面时,分页组件将越过表格的顶部。 On further inspection it is because the table is making its way outside of its outer div vertically.在进一步检查中,这是因为表格垂直地超出了其外部 div。 I have tried looking at other peoples examples however they do not solve this issue.我试过看其他人的例子,但他们没有解决这个问题。 FYI the {row} variable produces 10 rows of data.仅供参考,{row} 变量产生 10 行数据。

Thanks!谢谢!

           <div style = {{height: "400px"}}>

               <table style={{width:"100%", textAlign: "center", tableLayout: "fixed"}}>
                    <tbody>
                        <tr style = {{border: "solid black 1px"}}>
                            <th>Product Name</th>
                            <th>Product Code</th> 
                            <th>Price</th>
                            <th>Units Sold</th>
                            <th>Category</th> 
                            <th>Number in Stock</th>
                            <th>+</th>
                        </tr>
                        {row}
                    </tbody>
                </table>  

            </div>

            <div style = {{textAlign: "center"}}>
                <Pagination/>
            </div>

The solution to the issue was to give the outer div { display: table }该问题的解决方案是给外部 div { display: table }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM