1

I'm creating a website in Twitter Bootstrap 3. This is what I have so far. http://ts-mc.net/

Everything works fine, however, the image on the homepage stretches out. I want to keep it so that the image isn't responsive, that way it works fine on mobile devices, however I'd like to get rid of the excess image that isn't displayed.

j08691
  • 204,283
  • 31
  • 260
  • 272
Jerred Shepherd
  • 530
  • 1
  • 6
  • 18
  • Try to avoid linking to external sites: the question will lose context over time due to link rot and changes. Try porting your question over to a JSfiddle, for example. – Terry Apr 04 '14 at 01:00
  • My apologies! I haven't used stackoverflow before. – Jerred Shepherd Apr 04 '14 at 03:01

1 Answers1

1

Use overflow:hidden on a container div. See this fiddle.

HTML

<div><img src='src'></div>

CSS

div
{
    overflow:hidden;
    width:80px;
}

You can set the container div width and height to 100% and then the rest of the image will be cropped.

If it is a background image then use a pseudo element as described here.

Update

As you mention overflow-x:hidden is a good refinement of overflow-hidden if you just want to crop the width.

Community
  • 1
  • 1
acarlon
  • 16,764
  • 7
  • 75
  • 94