특정 CSS문제가 생기지 않도록 하는 스니펫 콜렉션
이미지 늘려짐/찌그러짐 방지
object-fit: cover;
Flexbox 줄바꿈
flex-wrap: wrap;
고정 높이 -> height 보다는 min-height ,고정 너비 -> width 보다는 min-width 사용
min-width: 320px;
min-height: 980px;
CSS 변수 폴백 값 주기
max-width: calc(100% - var(--actions-width, 70px));
줄바꿈 되지 않아야할 긴 콘텐츠
text-overflow: ellipsis; white-space:nowrap; overflow: hidden;
스크롤 연쇄 잠금
overscroll-behavior-y: contain;
배경 반복 제거
background-repeat: no-repeat;
필요할때만 스크롤바 보이기
overflow-y: auto;
스크롤바 생길때 레이아웃 변화 없애기
scrollbar-gutter: stable;
Flexbox 에서 최소 콘텐츠 사이즈 지정
min-width: 0; /*기본값이 auto 여서 overflow 발생*/
CSS Grid에서 최소 콘텐츠 사이즈 지정 minmax() 사용
Flexbox 아이템 배열시 justify-content: space-between; 대신 gap: 1rem; 사용
gap: 1rem;
이미지 최대 넓이 지정
max-width: 100%
이미지 위에 하얀 텍스트 올리때 이미지 로딩 실패시 대응
background-color: grey;
- 버티컬 미디어 쿼리 활용 → position:sticky 같은거 쓸 때 특정 세로크기 이상에서만 적용 @media (min-height:600px) {}
- CSS Grid 위에서 고정 값 사용은 조심 → 항상 미디어 쿼리 사용할 것
- CSS Grid 사용시 Auto Fit vs. Auto Fill → 대부분의 경우 auto-fill 이 나음
- 그리드 컨테이너 차일드에 postition: sticky 사용시 align-self: start 적용
- 그룹 셀렉터 지정은 다른 브라우저에서는 안될수 있으니 각각으로 분리할 것
https://developer.mozilla.org/ko/docs/Web/CSS/var()
var() - CSS: Cascading Style Sheets | MDN
CSS var() 함수는 사용자 지정 속성 (en-US), 또는 "CSS 변수"의 값을 다른 속성의 값으로 지정할 때 사용합니다.
developer.mozilla.org
A Complete Guide to Flexbox
https://css-tricks.com/snippets/css/a-guide-to-flexbox/
A Complete Guide to Flexbox
Our comprehensive guide to CSS flexbox layout. This complete guide explains everything about flexbox, focusing on all the different possible properties for the parent element (the flex container) a…
css-tricks.com
Best CSS Code Snippet Sites
https://css-tricks.com/snippets/
Code Snippets
Visit the post for more.
css-tricks.com
Code Snippet - Snipplr Social Repository
snipplr.com
https://stackoverflow.com/questions/tagged/css
Newest 'css' Questions
Stack Overflow | The World’s Largest Online Community for Developers
stackoverflow.com
본문 참고 https://news.hada.io/topic?id=5512
방어적(Defensive) CSS | GeekNews
특정 CSS문제가 생기지 않도록 하는 스니펫 콜렉션- Flexbox 줄바꿈 → flex-wrap: wrap;- 여유 공간 주기 → margin-right: 1rem;- 줄바꿈 되지 않아야할 긴 콘텐츠 → text-overflow: ellipsis; white-space:nowrap; overflow:
news.hada.io
'UXUI Development > CSS' 카테고리의 다른 글
[CSS3] 3D Transform - Perspective (투영점) (0) | 2022.04.06 |
---|---|
[CSS] background-image 이미지 흐리게 나올경우 선명하게 하기 (1) | 2022.03.29 |
[CSS] border effect css (0) | 2020.07.22 |
[CSS] 배경이미지 종횡비율 유지 반응형 적용 (0) | 2020.05.20 |
[CSS] PNG, SVG 파일 CSS로 색상 변경하기 (0) | 2019.01.14 |
[CSS] 페이지의 하단에 footer 고정 시키기 (0) | 2019.01.10 |
[CSS] CSS Units 반응형 (em, rem, vw, vh, %) (0) | 2018.10.05 |
[CSS3] Flexbox (display:flex, justify-conent, align-items, flex-grow, flex-basis) (0) | 2018.07.16 |