将两个gridview放在一起。

时间:2022-02-25 15:00:46

I want to have two gridviews on top of each other like so:将两个gridview放在一起。

我想把两个网格视图放在一起,如下所示:

The top one has style float:right and overflow: auto for a scroll bar.

顶部有样式浮动:右和溢出:自动为滚动条。

The bottom one has style overflow: auto for a scroll bar as well.

底部有样式溢出:自动为滚动条。

However, when I try to view my page, gridview 2 ends up to the left of gridview 1 (unless I remove overflow: auto). Is there a way to fix that? I tried using <br> but that didn't help.

然而,当我试图查看我的页面时,gridview 2最终位于gridview 1的左边(除非我删除overflow: auto)。有办法解决这个问题吗?我试过使用
,但没用。

2 个解决方案

#1


1  

Add a <div> element between the two gridviews with style="clear: both;" which will act as a break between the floating elements.

在两个gridview之间添加一个

元素,样式="clear: both ",这将作为浮动元素之间的中断。

OR you could just add style="clear: both;" to each gridview.

或者你可以在每个gridview中添加style="clear: both;"

#2


0  

You have two options here.. As @Mike suggested add Clear:both for both the div..

你有两个选择。正如@Mike建议的,添加清楚的:两个div。

Or place the Two grids entirely in different div..

或者将两个网格完全放在不同的div中。

As the div is a block level element they will fall one below another..

因为div是块级元素,所以它们会在另一个下面。

#1


1  

Add a <div> element between the two gridviews with style="clear: both;" which will act as a break between the floating elements.

在两个gridview之间添加一个

元素,样式="clear: both ",这将作为浮动元素之间的中断。

OR you could just add style="clear: both;" to each gridview.

或者你可以在每个gridview中添加style="clear: both;"

#2


0  

You have two options here.. As @Mike suggested add Clear:both for both the div..

你有两个选择。正如@Mike建议的,添加清楚的:两个div。

Or place the Two grids entirely in different div..

或者将两个网格完全放在不同的div中。

As the div is a block level element they will fall one below another..

因为div是块级元素,所以它们会在另一个下面。