Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

HTML <tr> tag and position:relative

Tags:

html

css

firefox

I am dealing with html writen long time ago and there is a problem with FireFox.
Some tr elements have position property set to relative , which surprisingly makes the border of those tr's invisble. When I remove the style, it all works fine... so the question is:
"How does position:relative affect tr element?" I can't get it.. for me it seems redundant.

Thanks

EDIT:

<table id="table1"  width="100%" cellspacing="0" cellpadding="0" border="0" bgcolor="#cccccc"><tbody>
<tr class="header" style="position:relative;top:2 px;">
    <th>sdf</th>
    <th>sdf</th>
    <th>sdf</th>
</tr>

.header {
    position:relative;
}


table#table1 {
    border-collapse: collapse;    
}

#table1 th {
    border-collapse: collapse;
    cursor: pointer;
    font-size: 8pt;
    padding: 3px;
    border-left: 1px solid #666666;
    border-right: 1px solid #666666;
    border-bottom: 1px solid #666666;
    color: #FFFFFF;
    background-color: #6685C2;
}

#table1 td {
    border-collapse: collapse;
    cursor: pointer;
    font-size: 8pt;
    padding: 3px;
    border: 1px solid #666666;
}
like image 991
Andrew Avatar asked Jul 19 '11 11:07

Andrew


People also ask

How do you position a relative in HTML?

An element with position: relative; is positioned relative to its normal position. Setting the top, right, bottom, and left properties of a relatively-positioned element will cause it to be adjusted away from its normal position. Other content will not be adjusted to fit into any gap left by the element.

What is absolute and relative position in HTML?

Relative - the element is positioned relative to its normal position. Absolute - the element is positioned absolutely to its first positioned parent. Fixed - the element is positioned related to the browser window.

What is the tag TR in HTML?

<tr>: The Table Row element. The <tr> HTML element defines a row of cells in a table. The row's cells can then be established using a mix of <td> (data cell) and <th> (header cell) elements.


1 Answers

I'm also not entirely sure without seeing code, but:

From the spec: http://www.w3.org/TR/CSS21/visuren.html#propdef-position

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.

tr is a table-row.

like image 166
thirtydot Avatar answered Oct 20 '22 05:10

thirtydot