E
E
eellazy2015-10-09 20:27:44
css
eellazy, 2015-10-09 20:27:44

What are the ways to align position:absolute?

Hi everybody!
What are the ways to align a block with position:absolute.
There is right, top, left, bottom. I would like to know, maybe people still somehow equalize.
The bottom line is that in the absence of the property right. The block becomes as it should, that is, the indent of the parent is taken into account. But when I put right: 0, then the countdown goes from the edge of the window. You want the block to be right-aligned.
Here is a photo with no right. All parent margins are present
6b2428305d304ebea3de4a915197491e.png
When using right:0
31f777da4a2342fcb2cdd1b8c0fb5b78.png
As needed
aca55e0a8647490786965f2605926ff8.png
The code of the block to be aligned

width: 400px;
    padding: 20px 20px 0 20px;
    background: #fff;
    border: 1px solid #eaeaea;
    top: 62px;
    right: 0;
    position: absolute;
    z-index: 10;

Parent
padding-right: 10px;
    padding-left: 10px;
    margin-right: auto;
    margin-left: auto;

Answer the question

In order to leave comments, you need to log in

3 answer(s)
D
dk-web, 2015-10-09
@eellazy

position relative to the parent add.

O
Orzubek Rakhimov, 2015-10-09
@orzubek

position: absolute | fixed | relative | static | inherit

inherit - inherits the value of the parent.

G
GoodProject, 2015-10-09
@GoodProject

margin , padding ?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question