<span>
태그 .lastMessageLink
이 있고 그 안에 <a>
인 .lastMessageText
이 있습니다. .lastMessageText
에 넣을 수있는 텍스트는 몇 자만큼 짧거나 한 단락 일 수 있지만 최대 4 줄의 텍스트를 표시하려고합니다.스팬 태그 내 href에 대한 줄 수 지정
작동하지 않는 내가 가진 현재의 스타일은 이것이다 :
.lastMessageLink {
line-height: 1em;
text-overflow: ellipsis;
max-height: 4em;
overflow: hidden;
}
.lastMessageText {
color: black;
word-wrap: break-word;
}
을 그리고 여기에 HTML입니다 :
<span class="lastMessageLink">
<a id="undefined" class="lastMessageText" title="now i need a really really long message so that i can test this whole multiple lines thing which is gonna be a problem and a trickier problem than we had initially thought. it's interesting because you'd think a couple css styles would be enough, but we might have to go by characters" href="#conversation:cid=10714&mid=10735">
now i need a really really long message so that i can test this whole multiple lines thing which is gonna be a problem and a trickier problem than we had initially thought. it's interesting because you'd think a couple css styles would be enough, but we might have to go by characters
</a>
</span>
내가 HTML/CSS: Specify number of lines inside <span> 살펴 보았다, Limit text length to n lines using CSS, Using CSS text-overflow to vary the number of lines of text within an element of a set height 및 How to set element height for a fixed number of lines of text .
jQuery 나 Javascript를 사용하는 솔루션에 열려 있습니다. CSS만으로는 진행할 수 없었습니다.
잘''태그는 (** 반대로 스타일을 지정하지 않고) ** 인라인 ** 요소이므로 치수를 제한하는 것이 의미가 없습니다. 이를 무시하고'display : block' 또는'display : inline-block'으로 만든 다음'max-height' 설정을 사용하여 높이를 제한 할 수 있습니다. HTML/CSS는 "텍스트 줄"개념을 너무 잘 이해하지 못합니다. – Pointy
HTML 부분을 게시 할 수 있습니까? 그것이 작동하지 않는다고 할 때, 어떻게 작동하지 않는가? (줄 수, 오버플로, 표시되지 않는지 등) – Rodolfo
@Pointy는 이것을 무시하고 그것들을'display : block'으로 만들 수있다. – Rodolfo