The first line of text in the third .box
is raised above the top of the div and cut off. I would like it to appear the same as the second box (well actually ideally like the second box plus a ...
).
- Can this be done with flexbox?
- If not, can it be done with other CSS?
- If not, what's the best way to do it with JS?
- And on a separate note, why isn't the first box's text center-aligned?
http://codepen.io/loren/pen/ojxORN
<div class='box'>
one line of text
</div>
<div class='box'>
two lines of text lorem ipsum
</div>
<div class='box'>
thre lines of text lorem ipsum sin dolor whatever etc
</div>
.box
height 40px
font-size 16px
width 150px
border 1px solid black
margin-bottom 40px
display flex
align-items center
text-align center
overflow-y hidden