Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When to use CSS positioning?

Tags:

html

css

I am new to the world of coding, XHTML, CSS as well as PHP. I have come across numerous tutorials regarding positioning i.e. relative, absolute and fixed however have no idea when I have to use them or when it is the best to use them. I would appreciate some examples.

like image 636
PeanutsMonkey Avatar asked May 14 '11 17:05

PeanutsMonkey


1 Answers

Two that I frequently use are:

Relative positioning: helps you style elements relative to other elements. E.g. you want to move an input to the right relative to the div it's inside.

Fixed positioning: great for things like Refresh suggestions that get 'fixed' so that they follow you wherever you scroll.

It's best to play around with them and see for yourself.

like image 78
Kamil Sindi Avatar answered Oct 23 '22 17:10

Kamil Sindi