To crop the image inside a div container you need to define the width and the height of the container using absolute or relative units. Then, set the width and the height of the img or vid to 100% and specify the type of object-fit
object-fit: fill
object-fit: cover
object-fit: contain