jstl获取表格单元格值_表格单元格和位置绝对值

jstl获取表格单元格值

If you follow me on Twitter, you saw me rage about trying to make position: absolute work within a TD element or display: table-cell element.  Chrome?  Check.  Internet Explorer?  Check.  Firefox?  Ugh, FML.  I tinkered in the console...and cussed.  I did some researched...and I cussed more.  I found the 13 YEAR OLD ticket in Bugzilla...and threw Molotov cocktails into the street.  Luckily my whining on Twitter solicited an excellent solution from Andrew McGivery (@andrewmcgivery).  Check out the wonky solution that make this work!

如果您在Twitter上关注我 ,您会感到愤怒,因为我试图在TD元素或display: table-cell元素中position: absolute工作。 Chrome? 检查一下 IE浏览器? 检查一下 火狐浏览器? gh,FML。 我在控制台中进行了修补...然后受到了指责。 我做了一些研究...然后我提出了更多建议。 我在Bugzilla中发现了13岁的车票 ...然后把莫洛托夫鸡尾酒扔到了街上。 幸运的是,我在Twitter上的哀求吸引了 Andrew McGivery( @andrewmcgivery )的出色解决方案。 找出使这个工作可行的解决方案!

HTML (The HTML)

Here's the sample HTML we'll be using for this exercise:

这是我们将在此练习中使用的示例HTML:


<table >
	<tr>
		<td>
			<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua...</p>
		</td>
		<td>
			<div style="position:relative; overflow: auto; height: 100%;">
				<p>Lorem ipsum dolor sit amet.</p>
				<div style="position:absolute; bottom:0; right:0; background: yellow;">
					This will be positioned at 5,5 relative to the cell
				</div>
			</div>
		</td>
	</tr>
</table>


Alternatively you could use DIV elements with display: table-cell:

或者,您可以在display: table-cell使用DIV元素display: table-cell


<div class="table">
	<div class="cell">
		<p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.</p>
	</div>
	<div class="cell">
		<div style="position:relative; overflow: auto; height: 100%;">
				<p>Lorem ipsum dolor sit amet.</p>
				<div style="position:absolute; bottom:0; right:0; background: yellow;">
					This will be positioned at 5,5 relative to the cell
				</div>
			</div>
	</div>
</div>


Either of these examples will work.

这些示例都可以使用。

CSS (The CSS)

It turns out that pinning height: 100% on the way up the stack cures our absolute positioning blues:

事实证明,钉扎height: 100%在堆栈上升的过程中height: 100%可以治愈我们的绝对定位问题:


table, tr { height: 100%; }


Here's the craziness with a DIV structure:

这是DIV结构的疯狂之处:


.table { display: table; }
.cell { display: table-cell; }
.table, .cell { height: 100%; }


Incredibly odd adding the 100% height to the container, yes?  Well, unfortunately that's what we'll need to do until the bug in Firefox is fixed.

将100%的高度添加到容器中非常奇怪,是吗? 好吧,不幸的是,这是我们需要做的,直到Firefox中的错误得到修复。

As much as this type of bug annoys the hell out of us, these type of bugs separate the experts and novices.  Well done to Andrew for finding the solution to this heinous problem.  Keep this post handy as you may need it if that Firefox bug lasts another 13 years!

尽管这类错误使我们烦恼不已,但这些错误将专家和新手分开。 安德鲁(Andrew)为解决这个令人发指的问题提供了解决方案,做得很好。 如果该Firefox错误又持续了13年,您可以根据需要保留此帖子!

翻译自: https://davidwalsh.name/table-cell-position-absolute

jstl获取表格单元格值

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值