기본적으로 이미지 안에 제목이 있습니다. 아래의 코드와 예제에서 알 수 있듯이 이미지의 아래쪽에 위치하도록 음수 여백을 설정했습니다. 문제는 텍스트 위치/방향이 위에서 아래로 있다는 것입니다. 제목의 텍스트가 많을수록 더 길어질 것입니다. 나는 그것을 반대로하고 싶다. 그래서 텍스트 div는 그 크기에 따라 텍스트를 위로 확장한다.텍스트 위치가 하단에서 오는 것입니다.
가능합니까? 미리 감사드립니다. 여기
는 예를 http://jsfiddle.net/j7gLd/
HTML
<div class="image">
<img src="image.jpg">
<div class="title">This is a title</div>
</div>
<div class="image">
<img src="image.jpg">
<div class="title">This is a title This is a title This is a title This is a title This is a title This is a title This is a title This is a title This is a title This is a title This is a title This is a title This is a title</div>
</div>
CSS
.image {
width: 800px;
height: 530px;
margin: 10px;
}
.title {
position: absolute;
background-color: #CCC;
max-width: 600px;
margin-top: -80px;
padding: 5px;
}
변경 이미지 :뿐만 아니라 상대. – KnowHowSolutions