The left section of a channel in https://spectrum.chat/apollo?tab=posts is scrollable but the scrollbar is hidden. How did they do it ?
In CSS class ctZiQt I found that they are using overflow
with grid-area
and sticky
position but I couldn't find anything about the scrollbar itself.
I tried to recreate it but the scrollbar in my snipped is always visible. How did they hide the scrollbar ?
Thx
EDIT:
Here is how they do it. missed the class in my original code
.ctZiQt::-webkit-scrollbar {
width: 0px;
height: 0px;
background: transparent;
}
<html>
<head>
<style>
html {
display: flex;
min-height: 100%;
width: 100%;
box-sizing: border-box;
font-size: 16px;
line-height: 1.5;
background-color: rgb(250, 250, 250);
color: rgb(22, 23, 26);
-webkit-font-smoothing: auto;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica,
Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji",
"Segoe UI Symbol";
padding: 0px;
margin: 0px;
}
body {
box-sizing: border-box;
width: 100%;
height: 100%;
overscroll-behavior-y: none;
}
#root {
height: 100%;
width: 100%;
}
@media (min-width: 1648px) {
.wrapper {
grid-template-columns: 256px 1fr;
grid-template-areas: "navigation main";
}
}
.wrapper {
display: grid;
width: 100%;
grid-template-columns: 72px 1fr;
grid-template-areas: "navigation main";
}
@media (min-width: 1648px) {
.navigation {
width: 256px;
}
}
.navigation {
background-color: yellow;
position: sticky;
top: 0px;
width: 72px;
height: 100vh;
grid-area: navigation / navigation / navigation / navigation;
overflow: hidden auto;
}
.main {
display: grid;
justify-self: center;
grid-template-columns: minmax(320px, 400px) minmax(600px, 968px);
grid-template-rows: 100%;
grid-template-areas: "secondary primary";
max-width: 1392px;
gap: 24px;
margin: 0px 24px;
}
.secondary {
background-color: green;
height: 100vh;
position: sticky;
top: 0px;
padding-bottom: 48px;
overflow: hidden auto;
grid-area: secondary / secondary / secondary / secondary;
}
.primary {
background-color: blue;
height: 100%;
max-width: 968px;
display: grid;
grid-template-rows: 1fr;
border-left: 1px solid rgb(235, 236, 237);
border-right: 1px solid rgb(235, 236, 237);
border-bottom: 1px solid rgb(235, 236, 237);
border-radius: 0px 0px 4px 4px;
grid-area: primary / primary / primary / primary;
}
.content {
height: 3502px;
display: flex;
flex-direction: column;
justify-content: space-between;
background: rgb(255, 255, 255);
}
.card {
margin-top: 24px;
background: rgb(255, 255, 255);
border-width: 1px;
border-style: solid;
border-color: rgb(235, 236, 237);
border-image: initial;
border-radius: 4px;
}
.cardHeader {
display: flex;
-webkit-box-align: center;
align-items: center;
-webkit-box-pack: justify;
justify-content: space-between;
position: sticky;
top: 0px;
z-index: 11;
border-bottom: 1px solid rgb(235, 236, 237);
padding: 16px;
background: rgb(255, 255, 255);
border-radius: 4px 4px 0px 0px;
}
.cardHeaderLabel {
font-size: 16px;
font-weight: 700;
color: rgb(36, 41, 46);
display: flex;
padding-right: 16px;
flex: 1 0 auto;
}
.cardContent {
height: 1950px;
display: flex;
justify-content: space-between;
flex-direction: column;
border-radius: 0px 0px 4px 4px;
overflow: hidden;
}
</style>
<script></script>
</head>
<body>
<div id="root">
<div class="wrapper">
<div class="navigation"></div>
<div>
<section class="main">
<section class="secondary">
<section class="card">
<div class="cardHeader">
<div class="cardHeaderLabel">Teams</div>
</div>
<div class="cardContent">
<span>START</span>
<span>END</span>
</div>
</section>
</section>
<section class="primary">
<section class="content">
<span>START</span>
<span>END</span>
</section>
</section>
</section>
</div>
</div>
</div>
</body>
</html>
You can hide the scrollbar with:
.secondary::-webkit-scrollbar {
display: none;
}
Here the example:
.secondary::-webkit-scrollbar {
display: none;
}
<html>
<head>
<style>
html {
display: flex;
min-height: 100%;
width: 100%;
box-sizing: border-box;
font-size: 16px;
line-height: 1.5;
background-color: rgb(250, 250, 250);
color: rgb(22, 23, 26);
-webkit-font-smoothing: auto;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica,
Arial, sans-serif, "Apple Color Emoji", "Segoe UI Emoji",
"Segoe UI Symbol";
padding: 0px;
margin: 0px;
}
body {
box-sizing: border-box;
width: 100%;
height: 100%;
overscroll-behavior-y: none;
}
#root {
height: 100%;
width: 100%;
}
@media (min-width: 1648px) {
.wrapper {
grid-template-columns: 256px 1fr;
grid-template-areas: "navigation main";
}
}
.wrapper {
display: grid;
width: 100%;
grid-template-columns: 72px 1fr;
grid-template-areas: "navigation main";
}
@media (min-width: 1648px) {
.navigation {
width: 256px;
}
}
.navigation {
background-color: yellow;
position: sticky;
top: 0px;
width: 72px;
height: 100vh;
grid-area: navigation / navigation / navigation / navigation;
overflow: hidden auto;
}
.main {
display: grid;
justify-self: center;
grid-template-columns: minmax(320px, 400px) minmax(600px, 968px);
grid-template-rows: 100%;
grid-template-areas: "secondary primary";
max-width: 1392px;
gap: 24px;
margin: 0px 24px;
}
.secondary {
background-color: green;
height: 100vh;
position: sticky;
top: 0px;
padding-bottom: 48px;
overflow: hidden auto;
grid-area: secondary / secondary / secondary / secondary;
}
.primary {
background-color: blue;
height: 100%;
max-width: 968px;
display: grid;
grid-template-rows: 1fr;
border-left: 1px solid rgb(235, 236, 237);
border-right: 1px solid rgb(235, 236, 237);
border-bottom: 1px solid rgb(235, 236, 237);
border-radius: 0px 0px 4px 4px;
grid-area: primary / primary / primary / primary;
}
.content {
height: 3502px;
display: flex;
flex-direction: column;
justify-content: space-between;
background: rgb(255, 255, 255);
}
.card {
margin-top: 24px;
background: rgb(255, 255, 255);
border-width: 1px;
border-style: solid;
border-color: rgb(235, 236, 237);
border-image: initial;
border-radius: 4px;
}
.cardHeader {
display: flex;
-webkit-box-align: center;
align-items: center;
-webkit-box-pack: justify;
justify-content: space-between;
position: sticky;
top: 0px;
z-index: 11;
border-bottom: 1px solid rgb(235, 236, 237);
padding: 16px;
background: rgb(255, 255, 255);
border-radius: 4px 4px 0px 0px;
}
.cardHeaderLabel {
font-size: 16px;
font-weight: 700;
color: rgb(36, 41, 46);
display: flex;
padding-right: 16px;
flex: 1 0 auto;
}
.cardContent {
height: 1950px;
display: flex;
justify-content: space-between;
flex-direction: column;
border-radius: 0px 0px 4px 4px;
overflow: hidden;
}
</style>
<script></script>
</head>
<body>
<div id="root">
<div class="wrapper">
<div class="navigation"></div>
<div>
<section class="main">
<section class="secondary">
<section class="card">
<div class="cardHeader">
<div class="cardHeaderLabel">Teams</div>
</div>
<div class="cardContent">
<span>START</span>
<span>END</span>
</div>
</section>
</section>
<section class="primary">
<section class="content">
<span>START</span>
<span>END</span>
</section>
</section>
</section>
</div>
</div>
</div>
</body>
</html>