HTML + CSS - Element position relative to the div

2

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

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

}

I would like to know how to position my element independent of the size of Div, since my div varies in size, so my position: absolute; needs to work with something dynamic rather than pixels like most of the examples available.

    
asked by anonymous 21.03.2017 / 19:51

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 */
}
    
21.03.2017 / 19:53