반응형
svg가 inline 요소와 같은 속성이기 때문에 수직 중앙 정렬 시 살짝 공간이 생길 수 있다
align-self
요소의 높이를 늘리고 싶을 때, height 100%을 생각했지만 flex 속성을 이용하고 있다면 간단하게 align-self를 이용할 수 있다!
아래까지 완
button 속성에 focus 하는 것이 가능한가 했더니 마지막으로 누른 커서가 어디에 있느냐에 따라 다른 차이가 있었다
components.scss
////////////////////////////////////////////////
/// LOGO
.logo {
height: 3.25rem;
margin-left: 2rem;
}
////////////////////////////////////////////////
/// SEARCH
.search {
flex: 0 0 40%;
display: flex;
align-items: center;
justify-content: center;
&__input {
font-family: inherit;
font-size: inherit;
color: inherit;
background-color: var(--color-grey-light-2);
border: none;
padding: 0.7rem 2rem;
border-radius: 100px;
width: 80%;
transition: all 0.7s;
margin-right: -3.5rem;
&:focus {
outline: none;
width: 100%;
background-color: var(--color-grey-light-3);
}
&::-webkit-input-placeholder {
font-weight: 100;
color: var(--color-grey-light-4);
}
}
&__input:focus + &__button {
background-color: var(--color-grey-light-3);
}
&__button {
border: none;
background-color: var(--color-grey-light-2);
&:focus {
outline: none;
}
&:active {
transform: translateY(2px);
}
}
&__icon {
height: 2rem;
width: 2rem;
fill: var(--color-grey-dark-3);
}
}
/// ////////////////////////////////////////////////
/// USER NAVIGATION
.user-nav {
display: flex;
align-items: center;
align-self: stretch;
& > * {
padding: 0 2rem;
cursor: pointer;
transition: all 0.3s;
height: 100%;
display: flex;
align-items: center;
}
& > *:hover {
background-color: var(--color-grey-light-2);
}
&__icon-box {
position: relative;
}
&__icon {
height: 2.25rem;
width: 2.25rem;
fill: var(--color-grey-dark-2);
}
&__notification {
font-size: 0.8rem;
height: 1.75rem;
width: 1.75rem;
border-radius: 50%;
background-color: var(--color-primary);
color: #fff;
position: absolute;
top: 1.5rem;
right: 1rem;
display: flex;
justify-content: center;
align-items: center;
}
&__user-photo {
height: 3.75rem;
border-radius: 50%;
margin-right: 1rem;
}
}
/// ////////////////////////////////////////////////
/// SIDE NAVIGATION
.side-nav {
font-size: 1.4rem;
list-style: none;
margin-top: 3.5rem;
&__item {
position: relative;
&:not(:last-child) {
margin-bottom: 0.5rem;
}
}
&__item::before {
content: "";
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 3px;
background-color: var(--color-primary);
transform: scaleY(0);
transition: transform 0.2s, width 0.3s 0.2s cubic-bezier(1, 0, 0, 1),
background-color 0.1s;
}
&__item:hover::before,
&__item--active::before {
transform: scaleY(1);
width: 100%;
}
&__item:active::before {
background-color: var(--color-primary-light);
}
&__link:link,
&__link:visited {
color: var(--color-grey-light-1);
text-decoration: none;
text-transform: uppercase;
display: block;
padding: 1.5rem 3rem;
display: flex;
align-items: center;
position: relative;
z-index: 10;
}
&__icon {
width: 1.75rem;
height: 1.75rem;
margin-right: 1rem;
// fill: var(--color-grey-light-3);
fill: currentColor;
}
}
/// ////////////////////////////////////////////////
/// LEGAL TEXT
.legal {
font-size: 1.2rem;
color: var(--color-grey-light-4);
text-align: center;
padding: 2.5rem;
}
/// ////////////////////////////////////////////////
/// GALLERY
.gallery {
display: flex;
&__photo {
width: 100%;
display: block;
}
}
/// ////////////////////////////////////////////////
/// HOTEL OVERVIEW
.overview {
display: flex;
align-items: center;
justify-content: space-between;
font-size: 2rem;
font-weight: 200;
border-bottom: 1px solid var(--color-grey-light-2);
&__heading {
font-size: 2.25rem;
font-weight: 300;
text-transform: uppercase;
letter-spacing: 1px;
padding: 1.5rem 3rem;
}
&__stars {
margin-right: auto;
display: flex;
}
&__icon-star,
&__icon-location {
width: 1.75rem;
height: 1.75rem;
fill: var(--color-primary);
}
&__location {
font-size: 1.2rem;
display: flex;
align-items: center;
}
&__icon-location {
margin-right: 0.5rem;
}
&__rating {
background-color: var(--color-primary);
color: #fff;
margin-left: 3rem;
align-self: stretch;
padding: 0 2.25rem;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
&__rating-average {
font-size: 2.25rem;
font-weight: 300;
margin-bottom: -3px;
}
&__rating-count {
font-size: 0.8rem;
text-transform: uppercase;
}
}
/// ////////////////////////////////////////////////
/// BUTTON INLINE
.btn-inline {
border: none;
color: var(--color-primary);
font-size: inherit;
border-bottom: 1px solid currentColor;
transition: 0.3s;
cursor: pointer;
background-color: transparent;
padding-bottom: 2px;
display: inline-block;
&:hover {
// color: var(--color-grey-dark-1);
// transform: scale(1.1);
// box-shadow: 3px 4px 4px rgb(222, 222, 222);
}
&:focus {
outline: none;
animation: pulsate 1s infinite;
}
}
@keyframes pulsate {
0% {
transform: scale(1);
box-shadow: none;
}
50% {
transform: scale(1.1);
box-shadow: 0 1rem 4rem rgba(0, 0, 0, 0.25);
}
100% {
box-shadow: none;
transform: scale(1);
}
}
반응형
'온라인 강의 > Advanced CSS and Sass [Udemy]' 카테고리의 다른 글
83. Building the Description Section - Part 2 (0) | 2023.08.03 |
---|---|
82. Building the Description Section - Part 1 (0) | 2023.08.03 |
80. Building the Hotel Overview - Part 1 (0) | 2023.08.03 |
79. Building the Navigation - Part 2 (0) | 2023.08.03 |
78. Building the Navigation - Part 1 (0) | 2023.08.03 |