본문 바로가기
TIL

HTML&CSS | 이미지 비율 유지하기

by 홍차23 2020. 9. 14.

Solve your image sizing and positioning problems forever.

https://medium.com/dev-genius/solve-your-image-sizing-and-positioning-problems-forever-7859e24118ce

 

img-container div 로 감싼 뒤,

img 내부 스타일링을 다음과 같이 한다.

background-image: url(""); 
background-position: center; 
background-size: cover; 
width: 100%; 
height: 100%;

 

How to remove a border of background-image

https://stackoverflow.com/questions/44785967/how-to-remove-a-border-of-background-image

img태그를 → div 로 바꾸고, border:none 속성 추가

 

 

Setting a backgroundImage With React Inline Styles

backgroundImage: url(${Background})

댓글