I could not find a solution to this issue and I want to change everything that I need, as long as I can save a couple of things.
The entire list item should be a link, the text inside this link should be oriented to the list item that has a background image. I need this fluid, so I prefer to use the top to keep the aspect ratio and create the right height. Using this top layer to create height, I canβt understand for life how to get the text vertically in the center. I saw several other questions that affect this question somewhat, but I did not find a single person. Please help me!
Here is a living example. I need text to vertically align to the middle of the blue elements. http://jsbin.com/OxuxECI/1/edit?html,css,output
HTML
<section> <ul> <li><a id="monday" href="_monday.html"><span>Monday</span></a></li> </ul> </section>
CSS
section { position: relative; width: 86.029411764%; height: 100%; margin: -6px auto 0 auto; overflow: hidden; } section ul { list-style-type: none; display: inline-block; width: 35%; min-width: 320px; padding: 0; margin: .8rem; height: 100%; } section li { width: 100%; display: block; background: url(_images/daybg_03.png) center center no-repeat; background-size: contain; margin: .8rem auto .8rem auto; text-align: center; font-size: 0; line-height: 0; } section ul li a { width: 100%; **padding-top: 14.95%;** display: inline-block; text-decoration: none; text-align: center; } section ul li a span { font-size: 1.3rem; color: white; text-align: center; }
html css aspect-ratio fluid-layout
Infinity Designs Sep 12 '13 at 6:03 2013-09-12 06:03
source share