What's new
HTML Forums | An HTML and CSS Coding Community

Welcome to HTMLForums; home of web development discussion! Please sign in or register your free account to get involved. Once registered you will be able to connect with other members, send and receive private messages, reply to topics and create your very own. Our registration process is hassle-free and takes no time at all!

Image too large in container

chizzy

New member
HI, Hope all is good. Could someone help me please with an example I'm using to learn from. Its a slide show that works ok with images of 600 X 400 , but when i try to use an image of 1280 X 720 i cant get it to stay in the container and it takes over the screen. I've tried using object-fit cover, contain and altering the img dimension but still get the same results when i use a larger image. THe code below is what i thought was relevant for the container and the image Any help would be appreciated …thanks
Code:
img {
float:left;
width:auto;
height:300px
vertical-align: middle;
object-fit: cover;
}

/* Position the image container (needed to position the left and right arrows) */
.container {
width:auto;
position: relative;
height:600px;
}
 
Back
Top