사용자 경험을 측정하는 데에는 많은 요인이 있다.
사용자 경험의 일부분은 사이트와 컨텍스트에 한정되어 있지만,
모든 웹 경험에서 중요한 공통 집합인 'Core Web Vitals'가 있다.
이러한 핵심 사용자 경험 요구사항에는 로딩경험, 상호작용, 페이지 콘텐츠의 시각적 안정성 등이 포함됨
절대 아무런 대체재 없이 외곽선을 지우지 마시오
// 포커스, 포커스 비저블, 포커스 위드인 ----------------------------------------------------- /
@mixin focus(){
&:focus{
outline: 0;
border-radius: 2px;
box-shadow: 0 0 0 2px rgba($primaryBlue, 1);
}
}
@mixin focusVisible($visible: true){
@include focus();
@if $visible{
&:not(:focus-visible){
box-shadow: none;
@content
}
}
}
@mixin focusWithin($withIn: true){
@include focus();
@if $withIn{
&:focus-within{
@content
}
}
}
:focus
와 달리 키보드로 해당 엘리먼트를 선택해야만 적용됨:focus-visible {
outline: 3px solid #aaa;
}
:focus-visible
을 지원하는 브라우저가 많이 없음.js-focus-visible :focus:not(.focus-visible) {
outline: none;
}
:focus-within
을 이용해 접근성을 높일 수 있음.dropdown {
display: none;
}
.dropdown:hover {
display: block;
}
.dropdown.hover {
display: block;
}
@custom-selector :--heading h1 h2 h3 h4 h5 h6;
@for
문은 반복문
to를 사용하면 마지막 인덱스는 포함하지 않고
through을 사용하는 경우 마지막 인덱스는 포함됨
@for <variable> from <expression> to <expression> { ... }
@for <variable> from <expression> through <expression> { ... }
@for $i from 1 through 3 {
ul:nth-child(3n + #{$i}) {
background-color: lighten($base-color, $i * 5%);
}
}
ul:nth-child(3n + 1) {
background-color: #004080;
}
ul:nth-child(3n + 2) {
background-color: #004d99;
}
ul:nth-child(3n + 3) {
background-color: #0059b3;
}
@each
문은 list의 각 요소 또는 maps의 각 쌍에 대한 스타일을 내보내거나 코드를 쉽게 평가할 수 있음
@each <variable> in <expression> {...}
형태로 사용
$sizes: 40px, 50px, 80px;
@each $size in $sizes {
.icon-#{$size} {
font-size: $size;
height: $size;
width: $size;
}
}
.icon-40px {
font-size: 40px;
height: 40px;
width: 40px;
}
.icon-50px {
font-size: 50px;
height: 50px;
width: 50px;
}
.icon-80px {
font-size: 80px;
height: 80px;
width: 80px;
}
Maps와 함께 사용
SCSS SYNTAX
$icons: ("eye": "\f112", "start": "\f12e", "stop": "\f12f");
@each $name, $glyph in $icons {
.icon-#{$name}:before {
display: inline-block;
font-family: "Icon Font";
content: $glyph;
}
}
@charset "UTF-8";
.icon-eye:before {
display: inline-block;
font-family: "Icon Font";
content: "";
}
.icon-start:before {
display: inline-block;
font-family: "Icon Font";
content: "";
}
.icon-stop:before {
display: inline-block;
font-family: "Icon Font";
content: "";
}
clamp(min, prefered, max)
font-size: clamp(1rem, 2.5vw, 2rem);