Search
 
SCRIPT & CODE EXAMPLE
 

CSS

crop image in div

.myImage {
	height: 200px; /* need to define height and width explicitly (to my understanding) */
	width: 200px;

	background-size: cover; /* cover or contain */
	background-image: url('../../images/anderson-schmig-IayJpfDhj7E-unsplash.jpg'); /* load image */
	background-repeat: no-repeat; /* dont tile */
	background-position: center; /* center image | top, bottom, left, right, custom are also valid options */

	border: 1px solid black; /* see edges of container for seeing if we got any errors */
}	

<div class="myImage"></div>
Comment

PREVIOUS NEXT
Code Example
Css :: general sibling selector 
Css :: .col-12 bootstrap 
Css :: grid css fr width of content 
Css :: html css profile page template 
Css :: responsive flexbox 
Css :: css button style rectangle 
Css :: css change multiple classes 
Css :: reference images from css in django 
Css :: material css 
Css :: image cover css 
Css :: css animation-fill-mode 
Css :: scss mixin 
Css :: text slide animation css 
Css :: center div using flex 
Css :: make text available only to screen reader 
Css :: remove black shadow from border css 
Css :: css border radius first element and last element 
Css :: bootstrap text truncate after 3 lines 
Css :: How to force fully show the keyboard in android 
Css :: comentarios en archivo scss 
Css :: fixed image position while scrolling 
Css :: flex box css 
Css :: divider with text css 
Css :: django jsonfield 
Css :: NeuMorphisme button code 
Css :: css changer la couleur de la sélection 
Css :: flexbox froggy 
Css :: see css from site 
Css :: before width not working 
Css :: adding diffent style in firefox css 
ADD CONTENT
Topic
Content
Source link
Name
7+9 =