QUOTE:
最初由 renncpc 发布
sorry,
.fixed{
position:relative;
background-color: white;
}
position:relative 意思是相对位置。 position采用relative的元素,其位置是个相对位置,这就是导致你页面出现滚动条的时候,表格前两列跟着滚动条上下滚动的原因。
下面给出关于position 四个值得详细解释
The values of position have the following meanings:
static
The element's box is generated as normal. Block-level elements generate a rectangular box that is part of the document's flow, and inline-level boxes cause the creation of one or more line boxes that are flowed within their parent element.
relative
The element's box is offset by some distance. The element retains the shape it would have had were it not positioned, and the space that it would ordinarily have occupied is preserved.
absolute
The element's box is completely removed from the flow of the document and positioned with respect to its containing block, which may be another element in the document or the initial containing block (described in the next section). Whatever space the element might have occupied in the normal document flow is closed up, as though the element did not exist. The positioned element generates a block-level box, regardless of the type of box it would have generated if it were in the normal flow.
fixed
The element's box behaves as though it were set to absolute, but its containing block is the viewport itself.