h1.header__title.page-title Lorem#[br]Lorem lorem lorem
div.toster-border {
border: 2px solid black;
padding: 2px;
margin: 10px;
display: inline-block;
}
div.toster-border::before {
content: '';
position: absolute;
border-top: 4px solid orange;
border-left: 4px solid orange;
left: 0;
top: 0;
width: 16px;
height: 16px;
margin: 6px;
}
div {
position: relative;
display: inline-block;
padding: 20px;
background: white;
z-index: 1;
}
div:before, div:after {
content: "";
position: absolute;
display: block;
background: blue;
left: -10px;
top: -10px;
}
div:before {
width: 10px;
height: 40px;
}
div:after {
width: 40px;
height: 10px;
}
.xxx {
background: silver;
display: inline-flex;
justify-content: center;
align-items: center;
font-size: 24px;
padding: 0.3em 0.6em;
position: relative;
}
.xxx::before {
content: "";
width: 1em;
height: 1em;
left: -0.2em;
top: -0.2em;
background: orange;
position: absolute;
z-index: -1;
}
.link {
width: 150px;
height: 40px;
background: #ccc;
position: relative;
display: inline-flex;
justify-content: center;
align-items: center;
}
.link:before {
top: -5px;
left: -5px;
z-index: -1;
content: '';
width: 25px;
height: 25px;
display: block;
background: orange;
position: absolute;
}
<div class="fixed-bar">...</div>
.fixed-bar {
transition: 0.7s ease;
transition-property: transform, box-shadow;
height: 50px;
position: fixed;
left: 0;
top: 0;
width: 100%;
z-index: 100;
transform: translateY(-100%);
}
.fixed-bar.isShown {
box-shadow: 0 0 10px black;
transform: translateY(0);
}
const fixedBar = document.querySelector('.fixed-bar');
const toggleBar = function () {
let isShown = window.pageYOffset > window.innerHeight / 2;
fixedBar.classList.toggle('isShown', isShown);
}
toggleBar();
window.addEventListener('scroll', toggleBar);