I am using a banner for my website for mobiles and tablets. The size of banner is 278*386. The banner is getting squeezed on tablets and mobile. I am using the banner as background-image
property of a Div.
here is my css for the div.
For tablets:
@media (max-width: 767px) and (min-width: 480px){
.masthead {
color: #fff;
margin-bottom: 40px;
font-size: 18px;
line-height: 30px;
-webkit-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.1), 0 1px 10px rgba(0, 0, 0, 0.1);
-moz-box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.1), 0 1px 10px rgba(0, 0, 0, 0.1);
box-shadow: inset 0 -1px 0 rgba(0, 0, 0, 0.1), 0 1px 10px rgba(0, 0, 0, 0.1);
background-image: url('https://website.com/banner_mobile_11.jpg');
height: 475px;
position: relative;
top: 105px;
width: 100%;
background-size: contain;
background-repeat: no-repeat;
}
}
If I use background-size: contain;
it doesn't cover whole width of screen and leave space but I want full width banner, if I use background-size: Cover;
it gets stretched. same is the issue for mobile.
HTML:
<div class="parenthead">
<div class="masthead">
<div class="container">
<div class="row">
<div class="span6">
<h1>Connect with us!</h1>
<p>iFixandRepair helps get your mobile device back up and running again, servicing screen replacement, speaker repair, & more on phones, tablets, & computers.</p>
<div class="social_button">
<a href="https://www.facebook.com/pages/IFix-And-Repair/242100755854336" class="btn btn-primary btn-large" target="_blank" onclick="track_event('External Link', 'Facebook Home')">
<i class="icon-facebook"></i> Facebook
</a>
<a href="http://www.twitter.com/iFixandRepairW" class="btn btn-info btn-large" target="_blank" onclick="track_event('External Link', 'Twitter Home')">
<i class="icon-twitter"></i> Twitter
</a>
<a href="tel:+5619078349" class="btn btn-call btn-large">
<i class="icon-phone"></i> Call Us</a>
</a>
</div>
</div>
</div>
</div>
</div>
</div>
Banner: