dukDukz
CSS ) 글자의 overflow + div의 title 속성 본문


이렇게 글자가 더 길어서 삐져나오는 경우..
1. text-overflow 적용
<div className={cx('map_title_box')} title={name}>
<strong className={cx('map_title')}>{name}</strong>
</div>
.map_tit_box{
width: 210px;
height: auto;
margin: 0 auto;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
word-break: break-all;
}
이렇게 수정해주었다.
중요한건
{
width : 200px;
display : block;
overflow : hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
부모요소가 display 속성이 block 혹은 inline-block 이여야함.
text-overflow 속성은 block 형태에만 적용되기 때문.
2. div 의 title 속성 사용
잘린 글자에 마우스 오버하면 전체 텍스트가 나오게 하는 법.
img 는 alt 를 사용하고
div 는 title 을 사용하면 된다.
참고블로그
더보기
https://devbirdfeet.tistory.com/140
CSS - 텍스트가 넘칠때 생략하기
css 를 사용하다 보면 은근히 텍스트를 생략해야 할 때가 많다. 지난번에도 UI 작업하다가 버튼 안의 텍스트가 너무 길어 버튼 영역이 망가져 버렸다. 이럴때 너무 텍스트가 길면 ... 으로 생략되
devbirdfeet.tistory.com
https://bbaksae.tistory.com/25
alt속성과 title 속성 비교
안녕하세요? 오늘은 title과 alt의 차이점에 대해 설명해 보겠습니다. alt와 title 모두 이미지에서 말풍선을 보여주기 때문에, 다수의 사람들이 차이점을 모르는 경우가 많습니다.(저만 그런건 아니
bbaksae.tistory.com
'웹 개발 > HTML 과 CSS' 카테고리의 다른 글
[html] <code></code> code tag (0) | 2023.02.22 |
---|---|
2021.03.29 경일 기본 틀 (0) | 2021.03.29 |
2021.03.19 쉽게 만드는 Programmers layout (0) | 2021.03.19 |
2021.03.18 프로그래머스 홈페이지 레이아웃 잡아보기 (0) | 2021.03.18 |
2021.03.16 회색 네모 박스 위치 조정 (0) | 2021.03.16 |