Hi i am trying to scale down a background image which is set in a specific div to scale down for mobile screen like iphone or android but it is not scaling down instead it shows only a specific part of large image while i want that whole image decreases in size and readable
here is online link where you can verify and see the styling
http://houseofskills.pk/house-of-skills/website/index
<section id="intro">
<div class="black-overlay"></div>
<div class="container valign">
<div class="row">
<div class="col-md-12">
</div>
<div class="col-md-12 text-center">
</div>
<div style="font-weight: bold; color:black;" class="col-md-6 col-md-offset-3 text-center">
</div>
</div>
</div>
</section>
<style>
.valign{
position: relative;
top: 50%;
-webkit-transform: translateY(-50%);
-ms-transform: translateY(-50%);
transform: translateY(-50%);
}
.container {
position: relative;
}
</style>
Also i am using backstrech to set the background image
<script>
$("#intro").backstretch("<?php echo base_url('assets/img/banner.jpg');?>");
</script>
Backstretch is setting inline styles that force your image to display at its maximum width at all times.
Using a Jquery plugin like Backstretch to set a background image is quite unnecessary. It would be far more efficient and clean to set the background image in your CSS like so:
HTML:
CSS:
With that being said, if you really really need to use backstretch to set the background image, you can overwrite the inline CSS after it is initialised with:
This takes advantage of the fact the backstretch is using absolute positioning. It sets all the edge parameters to 0 and then gives a margin of
autowhich will horizontally and vertically centre an absolute element. Again, this is a dreadfully inefficient way to set a background image.