태그 보관물: css

css

오버플로 : 끝에 숨겨진 점 거짓말을 할 수 없습니다 “라는

큰 엉덩이를 좋아하고 거짓말을 할 수 없습니다 “라는 문자열이 있고으로 잘라서 overflow:hidden다음과 같이 표시 한다고 가정 해 봅시다 .

나는 큰 엉덩이를 좋아하고 나는 cann

텍스트를 잘라냅니다. 이것을 다음과 같이 표시 할 수 있습니까?

나는 큰 엉덩이를 좋아하고 통조림 …

CSS를 사용합니까?



답변

텍스트 오버플로를 사용할 수 있습니다 : 줄임표; 이는 caniuse에 따라 모든 주요 브라우저에서 지원됩니다.

다음 은 jsbin에 대한 데모 입니다.

.cut-text {
  text-overflow: ellipsis;
  overflow: hidden;
  width: 160px;
  height: 1.2em;
  white-space: nowrap;
}
<div class="cut-text">
I like big buts and I can not lie.
</div>

답변

문제의 다음 스 니펫을 확인하십시오.

div{
  width : 100px;
  overflow:hidden;
  display:inline-block;
  text-overflow: ellipsis;
  white-space: nowrap;
}
<div>
    The Alsos Mission was an Allied unit formed to investigate Axis scientific developments, especially nuclear, chemical and biological weapons, as part of the Manhattan Project during World War II. Colonel Boris Pash, a former Manhattan P
</div>

답변

선을 최대 3 개로 제한하고 3 개의 선 후에 점이 나타나는 경우이 방법을 사용하십시오. 줄을 늘리려면 -webkit-line-clamp 값을 변경하고 div 크기의 너비를 지정하십시오.

div {
   display: -webkit-box;
   -webkit-line-clamp: 3;
   -webkit-box-orient: vertical;
   overflow: hidden;
   text-overflow: ellipsis;
}

답변

잘하면 그것은 당신에게 도움이됩니다 :

.text-with-dots {
    display: block;
    max-width: 98%;
    white-space: nowrap;
    overflow: hidden !important;
    text-overflow: ellipsis;
}
<div class='text-with-dots'>Some texts here Some texts here Some texts here Some texts here Some texts here Some texts here </div>

답변

text-overflowCSS 3 의 속성을 통해 가능합니다. 주의 사항 : 아직 브라우저에서 보편적으로 지원되지는 않습니다.


답변

부트 스트랩 4 에서는 .text-truncate줄임표로 텍스트를 자르는 클래스를 추가 할 수 있습니다 .

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js"></script>

<!-- Inline level -->
<span class="d-inline-block text-truncate" style="max-width: 190px;">
  I like big butts and I cannot lie
</span>

답변

<style>
    .dots
    {
        display: inline-block;
        width: 325px;
        white-space: nowrap;
        overflow: hidden !important;
        text-overflow: ellipsis;
    }

    .dot
    {
        display: inline-block;
        width: 185px;
        white-space: nowrap;
        overflow: hidden !important;
        text-overflow: ellipsis;
    }
</style>