나는 반응이 빠른 이미지 기술을 사용하고 있었고, 혼란스러워하는 한 가지를 발견했습니다.CSS 반응 형 이미지 기술 미스터리
컨테이너 내부에 href
태그로 감싸 진 이미지가 있습니다. 컨테이너는 모든 것을 함께 보관할 수있는 웰, 컨테이너 역할을합니다. href
태그는 특정 크기가 정의 된 이미지 컨테이너로 사용됩니다. 이미지 width
은 컨테이너에 맞게 100 %로 설정됩니다. 여기
The HTML:
---------
<div class="img-conatiner">
<a href="#" class="img-grid">
<img src="http://placekitten.com/300/300" alt="kittens!">
</a>
<a href="#" class="img-grid">
<img src="http://placekitten.com/300/300" alt="kittens!">
</a>
<a href="#" class="img-grid">
<img src="http://placekitten.com/300/300" alt="kittens!">
</a>
<a href="#" class="img-grid">
<img src="http://placekitten.com/300/300" alt="kittens!">
</a>
<a href="#" class="img-grid">
<img src="http://placekitten.com/300/300" alt="kittens!">
</a>
<a href="#" class="img-grid">
<img src="http://placekitten.com/300/300" alt="kittens!">
</a>
</div>
The CSS
-------
body {
width: 90%;
margin: 0 auto;
background: tomato;
}
.img-grid {
width: 20%;
float: left; <-- what is this for?
padding: 10px;
-webkit-box-sizing: border-box;
}
.img-grid img {
width: 100%;
}
예 : http://jsfiddle.net/TBVWG/2/이
여기 float
없이 일이,이 기술은 이미지의 폭을 무시하고, 원래 크기로 불면 작동하지 않습니다 부모 컨테이너. 그러나 float
은 모든 것을 함께 유지하는 방법은 무엇입니까?
미리 감사드립니다.
당신이 준 링크는 모든 것을 설명했습니다. 감사! – Bobby