.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>
Code Example |
---|
Css :: css outline style |
Css :: scale down image css |
Css :: custom select dropdown css only codepen |
Css :: increase space between dashed border css |
Css :: css properties in html |
Css :: facebook box-shadow css |
Css :: blur background image css |
Css :: how to style the button |
Css :: how to style rule to apply the Border Box model css |
Css :: css line height |
Css :: centrizing a table with css |
Css :: padding block |
Css :: hide scroll bar when not needed |
Css :: text shadow in css |
Css :: keyframes |
Css :: remove black border from border css |
Css :: scss color black white |
Css :: calculate using n nth-child |
Css :: css text color |
Css :: css last child with class |
Css :: print zend db select query to string |
Css :: media quries |
Css :: text-align attribute in css |
Css :: html transition |
Css :: disable all animation divi for mobile |
Css :: indexes |
Css :: display inline |
Css :: how to code color css property |
Css :: css footer comes under aside |
Css :: css absolute in absolute |