


Блог IT-шника
Блог IT-шника
Привіт:) У цьому пості викладатиму готові рішення, свої власні напрацювання та замітки на CSS, якими користуюся у своїй роботі.
Більш детально — у пості "CSS-властивість font-weight — насиченість шрифту".
Більш детально — у пості "Шпаргалка адаптивності веб-сайту".
Іноді можна зустріти наступний код
<ul>
<li class="link">
<a href="#">Текст посилання</a>
</li>
</ul>
.link a {
color: red;
}
Селектор .link a{} коректно працюватиме. Але у верстці використання селекторів за типом (тегом) вважається поганою практикою. А тому в даному випадку було б коректніше та зручніше використати наступний код
.link {
color: red;
}
Щоб добитися цього результату, використайте значення inherit
для властивості color
:
a {
color: inherit;
}
.link {
color: red;
}
Тепер для всіх <a>
, що знаходяться у блоці з класом link
, буде застосовуватися колір red
.
<div class="circle"></div>
.circle {
position: relative;
width: 80px;
height: 80px;
border: 1px solid #93B2FF;
border-radius: 50%;
}
.circle::before {
content: "";
position: absolute;
left: 50%;
top: 50%;
width: 70px;
height: 70px;
transform: translate(-50%, -50%);
border-radius: 50%;
background: #93B2FF;
}
.circle {
position: fixed;
right: 40px;
bottom: 40px;
width: 80px;
height: 80px;
line-height: 78px;
border-radius: 50%;
border: 2px solid rgba(147, 178, 255, 0.8);
background-color: rgba(147, 178, 255, 1);
text-align: center;
transition: all 0.8s linear;
opacity: 1;
z-index: 999;
}
.circle:after,
.circle:before {
content: "";
position: absolute;
display: block;
top: 0px;
left: 0px;
right: 0px;
bottom: 0px;
width: 100%;
height: 100%;
animation-duration: 4s;
border-radius: 50%;
z-index: -1;
box-sizing: content-box ! important;
}
.circle:after {
background-color: rgba(147, 178, 255, 0.8);
animation-name: manimate_after;
animation-timing-function: linear;
animation-iteration-count: infinite;
opacity: 0;
}
.circle:before {
top: -2px;
left: -2px;
border: 2px solid rgba(147, 178, 255, 1);
animation-name: manimate_before;
animation-timing-function: linear;
animation-iteration-count: infinite;
opacity: 0;
}
.circle:hover {
animation-play-state: paused;
}
@keyframes manimate_after {
0% {
transform: scale(1);
opacity: 0;
}
45% {
opacity: 1;
transform: scale(1.5);
}
100% {
opacity: 0;
transform: scale(1);
}
}
@keyframes manimate_before {
0% {
transform: scale(1);
opacity: 0;
}
45% {
transform: scale(1.5);
opacity: 1;
}
100% {
transform: scale(2);
opacity: 0;
}
}
@keyframes manimate {
0% {
transform: scale(1);
opacity: 0;
}
30% {
border-width: 10px;
}
50% {
transform: scale(1.5);
opacity: 1;
}
100% {
transform: scale(2);
opacity: 0;
}
}
до змісту ↑
Реалізацію цієї задачі я описав в замітці.
<div class="long-arrow-left"></div>
<div class="long-arrow-right"></div>
.long-arrow-right,
.long-arrow-left {
display: block;
margin: 30px auto;
width: 25px;
height: 25px;
border-top: 2px solid #000;
border-left: 2px solid #000;
}
.long-arrow-left {
transform: rotate(-45deg);
}
.long-arrow-right {
transform: rotate(135deg);
}
.long-arrow-right::after,
.long-arrow-left::after {
content: "";
display: block;
width: 2px;
height: 45px;
background-color: black;
transform: rotate(-45deg) translate(15px, 4px);
left: 0;
top: 0;
}
Приклад коду у замітці.