CSS->Part 02->Selector & Position

Table of contents

No heading

No headings in the article.

In this lecture, we are going to study the following topics

Selector

  1. Choose nth-child

  2. select the first child

  3. select the last child

Position

  1. Fixed

  2. Static

  3. Relative

  4. Absolute

Selector--->Choose nth-child, first child and last child: -

We choose any child with the help of 2(n)

where n represent the numeric value like 1 ,2 and so on

Position: -

Static Position: - It is by default the position of each div or element.

Simply no use case

Fixed Position: - A element is fixed in HTML in such a way that when you scroll down your web page but that element is always there in its position.

In the below example you can understand better that fix doesn't change its position.

.four class is fixed Position

Relative Position: -

When we want to change a position from its original place then we use Relative. There are some properties which are used like top, right, bottom, and left.

It calculated its changed its position form its original position.

.two and .three class have position relative.

Absolute Position: -

Absolute change its position from its parent position.

If we gave absolute to id(#) or class(.) but it does't have any parent than BODY will became its Parent of that id or class.

Now I ahve challenge for you make folloeing outout using