问题
I have installed and am using IE10 and Chrome.
AND I'd like to fixed the top header <tr>
in <table>
.
but below style tag dose not working!!
<tr style="position:relative;top:expression(this.offsetParent.scrollTop);"></tr>
Do anybody have like this experience? If these were bug, I also want another solution to solve this problem. PLZ help me!
回答1:
Relative positioning inside of <table>
tags is not supported. Table rows in fact are simply containers for the bits that show in the GUI (the <td>
and <th>
). You can style the background color of the table row, but very few other visual aspects extend to this element. Because tables already contain positioning by design it's a waste of time trying to overwrite it. You should either use <div>
tags and style them with positioning or use the built-in Table CSS styles.
Additionally check out the answer here: Using Position Relative/Absolute within a TD?
回答2:
create some http://fiddle.jshell.net/
so we can understand your code.
来源:https://stackoverflow.com/questions/16515585/relative-positioning-not-working-on-a-table-row