html - Vertical align text in a Responsive Div -
i'm trying create promotional boxes our website using bootstrap framework.
i want div background image house vertically aligned content. believe i've succeeded partially, problem happens when width of div becomes larger amount set background-image size appear. there work around this?
for instance @ column width of 6 div 455px wide during breakpoints div becomes wider text content still thinks it's 455px.
here html:
<div class="col-md-6 col-sm-6"> <div class="promo-box01"> <div class="promo-text"> <h3>cta</h3> <p>limited time sale $45.00</p> <a href="#" class="btn btn-primary">shop now</a> </div> </div> </div> and here css:
.promo-box01 { background-image:url('../images/promo1.jpg'); background-size: cover; width:100%; height:150px; background-repeat:none; text-align: center; border-radius:3px; box-shadow: 0 0 4px #888; } .promo-box01 .promo-text { font-family:'roboto',arial,sans-serif; color:#fff; vertical-align: middle; width:450px; height:150px; line-height:1.5em; display: table-cell; } .promo-text h3 { font-family:'anton',arial,sans-serif; color:#fff; font-size:28px; }
try adding these classes "promo-box01":
-webkit-background-size: cover; -moz-background-size: cover; -o-background-size: cover; background-size: cover;
Comments
Post a Comment