CSS

[responsive] CSS - Responsive Image - (반응형 이미지) ★★★

목차
  1. 반응형 image 예제1 - 특정너비를 최대너비로 설정
  2. 반응형 image 예제2 - 해당이미지 너비를 최대너비로 설정
  3. 반응형 image 예제3 - 해상도별 다른 이미지 노출

 

반응형 image 예제1 - 특정너비를 최대너비로 설정 

 

<meta name="viewport" content="width=device-width, initial-scale=1.0">

 

<style>

img {

  width: 100%;

  height: auto;

  max-width:700px;

  display:block;

  margin:0 auto;

}

</style>


<img src="https://source.unsplash.com/random">


결과보기

※ max-width 없는 경우, 이미지 가로 길이가 부모너비 100% 차지.

 

반응형 image 예제2 - 해당이미지 너비를 최대너비로 설정

 

<meta name="viewport" content="width=device-width, initial-scale=1.0">

 

<style>

img {

  max-width: 100%;

  height: auto;

  display:block;

  margin:0 auto;

}

</style>

 

<img src="https://source.unsplash.com/random">


결과보기

 

반응형 image 예제3 - 해상도별 다른 이미지 노출

※ PC/mobile 다른 이미지 사용.

 

<style>

.pc{}

.mobile{display: none}

@media (max-width:750px ) {

    .pc{display: none}

    .mobile{display: inline;} 

}

</style>


<div>

    <img src="https://i.imgur.com/PQNhCln.gif" class="pc">

    <img src="https://i.imgur.com/YrkG5xB.gif" class="mobile">

</div>

 

결과보기



분류 제목
transform CSS - perspective-origin 속성 - 3D요소 바라보는 위치 (= perspective-or…
transform CSS - backface-visibility 속성 - 3D요소 뒷면 노출 여부. (= backface-vi…
transition CSS - transition 속성 ★★★ - 지정시간 동안 천천히 변화 (= transition속성 = 트…
transition CSS - transition-delay 속성 - 트랜지션 시작 대기 시간 (= transition-dela…
transition CSS - transition-duration 속성 ★ - 트랜지션 완료에 걸리는 시간 (= transiti…
transition CSS - transition-property 속성 - 트랜지션 효과 적용할 속성명 지정 (= transit…
transition CSS - transition-timing-function 속성 - 트랜지션 속도변경곡선 (= transit…
animation CSS - @keyframes 구문 - 애니메이션 코드 사용 선언 (= 애니사용 = @keyframes속성 …
animation CSS - animation 속성 ★ - 애니메이션 단축속성 (= animation속성 = 애니메이션속성, …
animation CSS - animation-delay 속성 - 애니지연시간 (= 작동지연시간 = 작동대기시간 = 작동준비시…
animation CSS - animation-direction 속성 - 애니방향 (= 움직임방향 = 애니메이션디렉션속성, I…
animation CSS - animation-duration 속성 - 애니지속시간 (= 애니완료소요시간 = 움직임완료소요시간…
animation CSS - animation-fill-mode 속성 - 애니미작동스타일 (= 움직임 작동안할때 스타일 = 애…
animation CSS - animation-iteration-count 속성 - 애니반복횟수 (= 움직임반복횟수, IE10…
animation CSS - animation-name 속성 - 키프레임명 (= 키프레임이름 = 애니이름 = 애니명 = 애니메…
11/33
목록
 홈  PC버전 로그인 일본어
그누앞단언어 1
그누뒷단언어
그외코딩언어
그누보드
제작의뢰
Q&A
커뮤니티 1
웹유틸
회원센터
홈짱닷컴 PC버전 로그인