Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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

enter image description here

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

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

.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?

>Solution :

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

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading