December 24, 201312 yr Ok so I have a featured client section in my website. They are greyed out logos that turn to colour images on hover. I am not sure if I have done it the best way.... but... I applied a background to a div rather than put an image within a div (hope that makes sense). This works great but it is not responsive at all, the image just cuts off as the div gets smaller. Could any one help me solve this issue? The html is like this:- <div id="development-bg"> <div id="development-wrap" class="row"> <div id="development" class="twelvecol"> <div id="logo-wrap" class="twelvecol"> <div class="logo-client1 threecol"></div> </div><!--/Development--> </div><!--/Development--> </div><!--/Development-Wrap--> </div><!--/Development-Bg--> CSS is:- #development-bg{width:100%; background-image:url(../img/ticks.png);} #development-wrap{} #development{height:auto; margin-bottom:20px; margin-top:20px;} #logo-wrap{height:auto; margin-top:10px;} .logo-boxes{height:75px; background-color:#666; width:150px;} .logo-client1{background-image:url(../img/client1.png); background-repeat:no-repeat; height:50px; padding-top:2px; -webkit-transition-duration: 1s; -moz-transition-duration: 1s; -ms-transition-duration: 1s; -o-transition-duration: 1s; transition-duration: 1s;} .logo-client1:hover{background-image:url(../img/client1-colour.png); background-repeat:no-repeat; height:50px; -webkit-transition-duration: 1s; -moz-transition-duration: 1s; -ms-transition-duration: 1s; -o-transition-duration: 1s; transition-duration: 1px;}
December 24, 201312 yr <div class="logo-client1 threecol"></div> Ok this may be a silly question but are your minimum div sizes for the threecol class larger than the logo size?
December 25, 201312 yr Yes I'm agree with Weedy. Can you please share live URL of this code we can help you better
December 26, 201312 yr Author Sorry my website is currently closed to the public so I cannot share a live link unfortunately. I am using the 1140px grid system for responsiveness. It usually fine and down-scales images no problem. However as these are background images in the CSS and not in the html it doesn't work. Originally I didn't set a width as the grid system uses columns, so by not declaring the width it would automatic just fit to the columns width. However, I tried putting in a set width to see if this would help the problem but it does not
December 26, 201312 yr If you're designing for responsiveness I don't think you should be using a fixed 1140px setting. Should be %'s instead.
December 27, 201312 yr Author It's a grid system using columns, goes from 1140px downwards. Works pretty well for what I need, just this one problem...
December 27, 201312 yr Author This code seems to work :-) have noted below just incase any one else needs this in future. background-size:contain; background-position:center;
Create an account or sign in to comment