HTML + CSS - Element position relative to div

Asked

Viewed 533 times

2

I’m failing to position my element at the top and the right end of the div. See that my div is slightly yellowish color, and my element "x" in red. This "x" is what I want to position.

inserir a descrição da imagem aqui

.ExcluirRelativePosition {
position: absolute;
top: -10px;
left: 115px;

}

I would like to know how to position my element independent of Div’s size, because my div varies in size, so mine position: absolute; need to work with something dynamic and not by pixels as most examples available.

1 answer

3


You could use top and right instead of left. Example:

.ExcluirRelativePosition {
    top: -10px;
    right: -10px; /* O botão vai sempre ficar ao final da div */
}

Browser other questions tagged

You are not signed in. Login or sign up in order to post.