Reputation: 11
I built a slider with 8 different pictures. On each picture, I wrote a caption.
I'm trying to set this caption with the css code :
.tp-caption{right:5%}
My ".tp-caption" div is out of my screen. I read that the 5% are relative to the parent element properties.
And in my case the parent element is my picture wich is larger than my window's width (picure is centered)
Do you know if I can specify 5% of my window screen ?
I tried with margin-right, float:right too ... but it's always the same problem
thank you for your help
Upvotes: 0
Views: 99
Reputation: 16841
The right
property is applied to positioned elements only, as stated on the MDN docs
So, for right
to be effective, your caption element would have to contain one of the position
's values, like relative
, absolute
or fixed
.
It's true, the right
offset will be relative to the element's parent. if you want it to be relative to the window's viewport, you should use then the position: fixed
on the element, that removes the element from the natural flow of the document, and makes it subject only to the viewport.
Upvotes: 1