LoginSignup
0
1

More than 1 year has passed since last update.

position・z-index

Last updated at Posted at 2022-11-14

position

基本的に単体で使う。relative,abosolute,fixed + topとかでずらす。
・relative
→staticの上段の辺から+-どのくらい動くか。
→後の要素には影響なし。そのままの位置。
・abosolute
→サイトの枠を基準にどのくらい。
→後に続く要素は詰める。
→囲んでいる要素に、relativeをつけるとそれが基準になる。
→left.rightを0にしたら、margin:auto;で中央になる。
→一番上に来る。絶対だから。
・fixed
→基準はサイトの枠。

position: fixed;
  top: 0;
  bottom: 0;
  right: 0;
  left: 0;

だと画面いっぱいに広がる。

Z-index

htmlは後から書いたのが上にくる。
それを変えたい時はz=indexを使う。数が大きい方が上に来る。

*w:100,h:100,borderがセットされていても、重ねると、borderはなくなる。

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1