positionについて
指定した数値分移動させることができる。absolute relativeの二つが大事。
absolute=絶対的 意地でも動いてくれないためこれだけだとレイアウト崩れる。周りが動いてもabsoluteは動いてくれないから。
relative=相対的 ↑を囲むように入れることでabusolute入れても崩れなくなる。
結論absolute使ったらrelativeで囲む事
例
#container{ width: 780px; height: auto; margin: 10px auto; background-color: #999; position: relative } #header { width: auto; height: 80px; margin: 10px; background-color: #DDD; } #header_inner { width: 360px; height: auto; position: absolute; top: 20px; right: 20px;
#header_innerにabsolute使ったから、header_inner囲ってる#containerにrelative使ってる。