![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I'm revamping the user interface of our CMS and want to put the controls for sorting content in its own column. My design entails having an up arrow at the top of the cell and a down arrow at the bottom. The rows can vary in height, which complicates things somewhat. My first thought was to set the cell that contains the up and down arrows position: relative and then set the arrow graphics themselves position: absolute with the top set to 0 for the up arrow and the the bottom set to 0 for the down arrow. I was expecting I'd run into some trouble in IE, but ironically it turns out that IE is the only browser that this functions in as I had expected it to. |
|
I suspect I'm doing something really dumb, but whatever it is that's wrong just isn't jumping out at me. If anyone else can spot it, or suggest another approach that'll work cross-browser (including IE6 : ( ), I'd appreciate any help you can offer. |
#3
| |||
| |||
|
|
I'm revamping the user interface of our CMS and want to put the controls for sorting content in its own column. My design entails having an up arrow at the top of the cell and a down arrow at the bottom. The rows can vary in height, which complicates things somewhat. My first thought was to set the cell that contains the up and down arrows position: relative and then set the arrow graphics themselves position: absolute with the top set to 0 for the up arrow and the the bottom set to 0 for the down arrow. I was expecting I'd run into some trouble in IE, but ironically it turns out that IE is the only browser that this functions in as I had expected it to. I suspect I'm doing something really dumb, but whatever it is that's wrong just isn't jumping out at me. If anyone else can spot it, or suggest another approach that'll work cross-browser (including IE6 : ( ), I'd appreciate any help you can offer. I've built a mockup at http://library.merus.co.uk/newbrowser.html |
#4
| |||
| |||
|
|
http://www.w3.org/TR/CSS21/visuren.html#propdef-position quote The effect of 'position:relative' on table-row-group, table-header-group, table-footer-group, table-row, table-column-group, table-column, table-cell, and table-caption elements is undefined. /quote All bets are specified to be off. You can't do this. |
#5
| |||
| |||
|
|
On 2009-04-15, Gordon <grj.mc... (AT) googlemail (DOT) com> wrote: I'm revamping the user interface of our CMS and want to put the controls for sorting content in its own column. *My design entails having an up arrow at the top of the cell and a down arrow at the bottom. *The rows can vary in height, which complicates things somewhat. My first thought was to set the cell that contains the up and down arrows position: relative and then set the arrow graphics themselves position: absolute with the top set to 0 for the up arrow and the the bottom set to 0 for the down arrow. *I was expecting I'd run into some trouble in IE, but ironically it turns out that IE is the only browser that this functions in as I had expected it to. Yes, I think that should work, but it doesn't in Firefox. There's sort of a get-out in the spec if you read it the right way so they could argue it's not technically wrong... I suspect I'm doing something really dumb, but whatever it is that's wrong just isn't jumping out at me. *If anyone else can spot it, or suggest another approach that'll work cross-browser (including IE6 : ( ), I'd appreciate any help you can offer. You can put another div inside the td, and set it to position: relative. Then put the absolutely positioned thing inside the div. It looks like you're setting the heights of the rows, so you can make that extra div height: 100% (needed to provide the correct reference point for the arrow at the bottom of the cell). Don't know if it works in IE. |
#6
| |||||
| |||||
|
|
On 2009-04-15, rf <rf@z.invalid> wrote: [...] http://www.w3.org/TR/CSS21/visuren.html#propdef-position quote The effect of 'position:relative' on table-row-group, table-header-group, table-footer-group, table-row, table-column-group, table-column, table-cell, and table-caption elements is undefined. </quote All bets are specified to be off. You can't do this. Yes but see also section 10.1 (definition of containing block) which makes no specific exception for table cells. The containing block in this case is provided by the nearest positioned ancestor, i.e. the table cell. |
|
My reading of the spec is that actually trying to _offset_ table cells with relative positioning is undefined, but that they really ought to work as containing blocks for positioned descendents. |
|
Offsetting is the effect, establishing a containing block is the side-effect. The effect may be undefined (explicitly in 9.3.1) but the side-effect _is_ defined, in 10.1. |
|
But regardless of such verbal quibbles, |
|
there's no good reason for a table cell not to be able to be a containing block. |
#7
| |||||||
| |||||||
|
|
Ben C wrote: On 2009-04-15, rf <rf@z.invalid> wrote: [...] http://www.w3.org/TR/CSS21/visuren.html#propdef-position quote The effect of 'position:relative' on table-row-group, table-header-group, table-footer-group, table-row, table-column-group, table-column, table-cell, and table-caption elements is undefined. </quote All bets are specified to be off. You can't do this. Yes but see also section 10.1 (definition of containing block) which makes no specific exception for table cells. The containing block in this case is provided by the nearest positioned ancestor, i.e. the table cell. Good point. My reading of the spec is that actually trying to _offset_ table cells with relative positioning is undefined, but that they really ought to work as containing blocks for positioned descendents. My reading is that specifying position: relative; for a td is, in and of itself, undefined. So the property should be simply ignored, as it appears to be in the case to hand. |
|
If the property is undefined then any side effects are also undefined, as is actually trying to _offset_ the td. |
|
Hmmm. It's odd that the other position values don't specify anything about table cells. Can one absolutely position them? Never tried :-) |
|
I was expecting something for top: and left: as well but then again would that mean anything, or rather should it mean anything, to use these for a td? |
|
Yes. But perhaps 10.1 should specifically state that you cannot establish a td as a containing block, because as per 9.3.1 you cannot position it, for example, relative. |
|
Consider also the display: value for at td. It's not block. It's table-cell. Perhaps what we are really talking about is that elements with display: table cell; cannot be positioned, at all, given that they already have "position" in the table. |
|
But regardless of such verbal quibbles, which we can indulge in for a long time if we are delving into the specs. there's no good reason for a table cell not to be able to be a containing block. Indeed and I have had to resort to stuffing in a containing div in there myself on occasion:-) |
![]() |
| Thread Tools | |
| Display Modes | |
| |