CSS auto padding top and bottom to always have the height covered

As in this test page https://play.pianohub.it/
I’m using three carousel sliders with two navigation arrows

CSS auto padding top and bottom to always have the height covered

If you hover over either the nav arrows, you’ll see that this div covers only a portion of the picture height, while I need it to span top to bottom.
I’m using this CSS

.arrow {
    font-size: 18px;
    padding-right: 7px;
    padding-left: 7px;
    background-color: rgba(22,22,22,0.29);
    color: #ffffff;

I tried to use padding:auto for top and bottom but it is not a thing. I should fix it by counting the needed pixel but it wouldn’t be responsive.

How can I set automatic padding?


Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

If the list-container and the arrow have the same father, you can set:

height: 100%;

so the height of the arrow will be as 100% as the father

All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Notify of

Inline Feedbacks
View all comments
Would love your thoughts, please comment.x