html - How to make the size of my text fill more of its existing line-height? -
i've setup mockup of page display users name, value, , units. i'm trying value in middle fill entire container. i've used vh
units set height of both font , parent, want number closer row boundaries above , below.
if add anymore height font-size, pushes row below down, causing scroll bar show up, , if play with/remove line-height jumps value above upper row boundary. responsively right works way i'd like, except value not filling more of container.
.row.userprofile { width: 100%; margin-left: auto; margin-right: auto; max-width: initial; } .person-1 { background-color: green; color: white; } .person-1 .person-name, .person-1 .person-value, .person-1 .person-units { font-weight: 700; text-align: center; text-transform: uppercase; } .person-1 .person-name, .person-1 .person-units { font-size: 9vh; line-height: 15vh; min-height: 15vh; } .person-1 .person-value { font-size: 70vh; line-height: 1.0; margin: 0; padding: 0; min-height: 70vh; }
<script src="https://cdnjs.cloudflare.com/ajax/libs/foundation/5.5.3/js/foundation.min.js"></script> <div class="row userprofile"> <div class="small-5 columns person-1"> <div class="row"> <div class="small-12 columns person-name">name</div> </div> <div class="row"> <div class="small-12 columns person-value">3</div> </div> <div class="row"> <div class="small-12 columns person-units">1 2 3</div> </div> </div> </div>
how remove more of space above , below number?
i don't think there's reliable way this, fonts render in several ways don't have control over. think closest can wrap number in <p>
tags , scale it. it's parent needs have it's overflow hidden not create scrollbar :
.person-1 .person-value { font-size: 70vh; line-height: 70vh; margin: 0; padding: 0; min-height: 70vh; overflow: hidden; } .person-1 .person-value p { -ms-transform: scale(1.38); -webkit-transform: scale(1.38); transform: scale(1.38); margin: 0; }
adding line height same container height compensate bit different rendering. times new roman font, factor of 1.38 looks limit - ie.
it done without scaling way (although myself), hiding overflow on parent works when giving text element larger size :
.person-1 .person-value { line-height: 70vh; margin: 0; padding: 0; min-height: 70vh; overflow: hidden; } .person-1 .person-value p { font-size: 100vh; margin: 0; }
Comments
Post a Comment