html - Positioning relative to table-cell -


the effect of 'position:relative' on table-row-group, table-header-group, table-footer-group, table-row, table-column-group, table-column, table-cell, , table-caption elements undefined.

source: http://www.w3.org/tr/css21/visuren.html#propdef-position

is there idea position relative have set display property table-cell using :before or :after selector?

.someclass{display: table-cell; position: relative; z-index: auto;}  /*this won't work*/ 

there kinda hacky way without additional elements using negative margin:

http://jsfiddle.net/cvyxm/1/

td span {     display: block;     width: 10px;     height: 10px;     margin: -5px;     background: red;     position: relative;     top: -5px;     left: -5px; } 

you position element relative cell, while eliminating dimensional impact on other elements adding negative margins on sides in correlation elements own dimensions.

problem here positioned element must have fixed dimensions (can't work percentage negative margin because depends on outer element).

the other, more common solution add additional wrapper element inside cell width position relative , position other child elements absolute wrapper.


Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

linux - Does gcc have any options to add version info in ELF binary file? -

java - Are there any classes that implement javax.persistence.Parameter<T>? -