Why do I have two vertical scrollbars and how do I remove one? The lorem is just so I can scroll and see how it looks like :) Sorry for some of the content being in another language aswell.
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html {
overflow-x: hidden;
}
body {
background-color: #262626;
font-family: "Roboto Slab", serif;
position: relative;
overflow-x: hidden;
}
main {
width: 100vw;
height: 100vh;
}
#backdrop {
width: 90%;
height: 100%;
margin: 0 auto;
margin-top: 1rem;
border-radius: 1rem 1rem 0 0;
background-color: #727365;
}
#home-link {
color: #f2f2e4;
text-decoration: none;
font-size: 1.7rem;
font-family: "Space Mono", monospace;
font-weight: 400;
position: absolute;
top: 1.95rem;
left: 2.6rem;
}
/* Hamburger menu */
#menu a {
text-decoration: none;
color: #3f403b;
}
#menu a:hover {
color: #0c0c0c;
}
#menu-toggle {
display: block;
position: absolute;
top: 2.5rem;
right: 3rem;
z-index: 1;
}
#menu-checkbox {
display: block;
width: 40px;
height: 32px;
position: absolute;
top: -7px;
left: -5px;
cursor: pointer;
opacity: 0;
z-index: 2;
}
#menu-toggle span {
display: block;
width: 33px;
height: 4px;
margin-bottom: 5px;
position: relative;
background: #f2f2e4;
border-radius: 3px;
z-index: 1;
transform-origin: 4px 0px;
transition: transform 0.5s cubic-bezier(0.77, 0.2, 0.05, 1),
opacity 0.55s ease;
}
#menu-toggle span:first-child {
transform-origin: 0% 0%;
}
#menu-toggle span:nth-last-child(2) {
transform-origin: 0% 100%;
}
#menu-checkbox:checked ~ span {
opacity: 1;
transform: rotate(45deg) translate(-2px, -1px);
background: #3f403b;
}
#menu-checkbox:checked ~ span:nth-last-child(3) {
opacity: 0;
transform: rotate(0deg) scale(0.2, 0.2);
}
#menu-checkbox:checked ~ span:nth-last-child(2) {
opacity: 1;
transform: rotate(-45deg) translate(0, -1px);
}
#menu {
width: 60vw;
height: 70vh;
position: absolute;
right: -100px;
margin: -100px 0 0 0;
padding: 50px;
padding-top: 125px;
border-radius: 1rem;
background-color: #bfbfae;
list-style: none;
transform-origin: 0% 0%;
transform: translate(100%, 0);
transition: transform 0.5s cubic-bezier(0.77, 0.2, 0.05, 1);
}
#menu li {
padding: 10px 0;
font-size: 22px;
}
#menu-checkbox:checked ~ ul {
transform: none;
opacity: 1;
}
/* Scrollbar */
::-webkit-scrollbar {
width: 13px;
}
::-webkit-scrollbar-thumb {
border-radius: 100px;
border: 3px solid transparent;
background-clip: content-box;
background-color: rgb(88, 88, 88);
}
::-webkit-scrollbar-thumb:hover {
background-color: rgb(109, 109, 109);
}
/* Media queries */
#media only screen and (min-width: 600px) {
}
#media only screen and (min-width: 769px) {
#backdrop {
width: 98%;
height: 96.5%;
border-radius: 1rem;
}
#menu-checkbox {
display: none;
}
#menu-toggle span {
display: none;
}
#menu {
-webkit-transition: none !important;
-moz-transition: none !important;
-o-transition: none !important;
transition: none !important;
transform: none !important;
background-color: #bfbfaee1;
padding: 0 1rem 0 1rem;
border-radius: 2rem;
font-family: monospace;
position: fixed;
top: 102vh;
right: 50%;
translate: 50% 0;
height: fit-content;
width: 45vw;
display: flex;
justify-content: space-between;
}
#menu li {
display: inline;
font-size: 1.2rem;
}
#active {
background-color: blue;
border-radius: 3rem;
}
.menu-links {
padding: 8px 35px 8px 35px;
}
#home-link {
display: flex;
justify-content: center;
position: static;
padding-top: 0.5rem;
}
}
<!DOCTYPE html>
<html lang="sv">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Överdäckningen | Startsida</title>
<link rel="stylesheet" href="css/style.css" />
<script src="script/js.js"></script>
<link
href="https://fonts.googleapis.com/css2?family=Roboto+Slab:wght#200;300;400&display=swap"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css2?family=Space+Mono&display=swap"
rel="stylesheet"
/>
</head>
<body>
<main>
<div id="backdrop">
<header id="wrapper">
<nav>
ÖVERDÄCKNINGEN
<div id="menu-toggle">
<input id="menu-checkbox" type="checkbox" />
<span class="hamburger-span"></span>
<span class="hamburger-span"></span>
<span class="hamburger-span"></span>
<ul id="menu">
<li><a class="menu-links" id="active" href="#">Länk 1</a></li>
<li><a class="menu-links" href="#">Länk 2</a></li>
<li><a class="menu-links" href="#">Länk 3</a></li>
<li><a class="menu-links" href="#">Länk 4</a></li>
</ul>
</div>
</nav>
</header>
</div>
<div>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Porro amet
dolores nisi delectus ad inventore laboriosam alias, architecto eos
sunt quod eum maiores provident aspernatur debitis ratione minus
quaerat cumque veniam. Delectus commodi odit molestiae excepturi.
Doloremque rem tempora quod est veritatis earum accusamus vel fugiat
numquam reprehenderit ad labore repudiandae recusandae neque
voluptatum a nulla dignissimos sapiente ut, officiis fugit porro.
Aliquid unde incidunt quisquam. Veniam sunt doloremque modi in
voluptates inventore. In corrupti hic eos, incidunt iusto dignissimos
praesentium ut adipisci possimus officiis nesciunt, eveniet asperiores
illum laudantium aliquid dicta temporibus aut maxime dolor fugit totam
animi velit repudiandae ea? Esse, quod repudiandae amet iusto
temporibus aperiam dolore aliquid, magni sunt eveniet deleniti at
suscipit quasi adipisci, quo officia accusantium repellat nostrum
nemo! Reiciendis repellat omnis facilis qui excepturi assumenda id
laborum vero voluptas, vitae aspernatur eius magnam voluptates iusto,
dolores a fugit tenetur quo nostrum ipsa sequi cumque? Velit voluptate
et at aut iste obcaecati nisi, vitae repellat placeat quasi iusto.
Rerum vero eos earum nobis in inventore quos aliquid id, assumenda
tempora? Modi repudiandae dolorem architecto ut animi doloribus,
tempore possimus nihil ipsum accusamus fugiat laboriosam culpa iure
eum mollitia ab? Quidem quas minus necessitatibus voluptate, rem vero
eligendi possimus totam voluptates laudantium atque illo provident
quasi! Laboriosam quo odio quia in! Commodi voluptatem facilis eos
neque non, magni fugiat numquam consectetur, ipsa dolores ut rerum,
sint sequi quos illo obcaecati omnis harum laudantium error inventore
praesentium. Commodi fugit nostrum asperiores vel ducimus
reprehenderit quis suscipit laborum et fugiat libero eius assumenda
esse nobis, iste, impedit ipsa repudiandae aut aspernatur placeat
inventore! Eligendi sit in obcaecati quia repudiandae explicabo
officia eveniet omnis earum. Quibusdam alias amet quas nobis ullam
vitae enim quod facilis quam maiores! Rem consequatur distinctio
laudantium harum labore, minus qui molestiae suscipit modi libero quia
pariatur maxime hic, voluptate totam numquam, illo beatae voluptatibus
atque ipsa assumenda. Ipsum laudantium, modi nam repellat similique
vitae asperiores corrupti accusamus voluptate maxime harum expedita,
ipsa fugiat obcaecati deserunt porro impedit blanditiis error
reprehenderit temporibus ex at, molestias eius magnam? Voluptatem,
repellat ratione distinctio sit odio assumenda non ad fugit eligendi
nemo eveniet enim porro asperiores, aliquam aliquid? Officia
reiciendis libero tempore cupiditate rem laboriosam odit aspernatur!
Perferendis, id odit. Laudantium, culpa. Iure placeat deserunt
consectetur! Cumque, asperiores itaque nobis laudantium fuga fugit,
nemo autem maiores quo et perferendis laborum illum quis suscipit
eveniet ullam modi. Soluta cum eaque, sequi eveniet deserunt quia odio
officia tenetur vero corrupti labore eum voluptatum quam cumque fuga
hic numquam! Ullam, a dolore omnis nemo beatae at possimus eum
officiis molestiae exercitationem temporibus ab blanditiis voluptatum
reiciendis mollitia maxime perspiciatis harum nostrum officia deleniti
delectus. Hic quos molestias rerum ducimus fugiat consectetur facilis
perspiciatis animi, incidunt error ut tenetur similique unde molestiae
labore perferendis sapiente totam mollitia! Qui, similique ad eos,
cumque laudantium sapiente dolores quas omnis nam fuga exercitationem
blanditiis quaerat aut animi at beatae explicabo nihil adipisci.
Voluptatum qui repudiandae provident ratione, tenetur illum fuga quas
sapiente laborum ipsa obcaecati aut quod perspiciatis, ullam, veniam
explicabo nulla quaerat incidunt quidem! Est odit corrupti quibusdam
doloribus! Vel excepturi voluptatum, nobis voluptatem error
consectetur placeat quibusdam architecto! Molestiae ipsum suscipit est
aperiam veniam nobis laboriosam porro alias, sit eos repellendus
labore, ratione unde ducimus, accusantium illum voluptatum. Tempore,
rem repellat, laboriosam velit aut aliquid ipsa quibusdam consectetur
soluta veniam architecto totam! Reiciendis aliquid vel voluptatem
tempore ea, unde officiis. Corrupti perspiciatis voluptates, suscipit
vero voluptatibus corporis commodi excepturi reprehenderit eos et
nulla voluptatem fuga porro maxime quam eius distinctio, at id aliquid
itaque consequuntur ut repudiandae. Officiis, qui eveniet animi
officia voluptate ipsum, fuga, nisi doloribus in obcaecati quia error
eaque ad cupiditate aliquam alias modi placeat mollitia quibusdam
illum quas aliquid sint? Eligendi, nostrum maiores quas iste
recusandae quae natus impedit consequatur id ipsam dignissimos sequi
excepturi, nobis ducimus dolorum tenetur repellendus praesentium in
dicta atque velit voluptatum quia. Placeat culpa aliquid ab natus
quaerat non quasi cupiditate reprehenderit soluta, unde repellendus
illum, praesentium distinctio blanditiis quod magnam laborum excepturi
iusto molestiae accusamus dolorem nihil. Voluptatum, molestias
debitis? Ipsum veritatis iure suscipit, saepe alias aliquam enim,
officiis deleniti soluta ratione tempora maxime ab beatae autem
accusamus nemo sit, porro dolore illum esse hic. Repudiandae expedita
iste, inventore, officia, ut voluptatibus unde ullam sint debitis enim
ipsa dolorum ducimus quos. Suscipit tenetur ratione sed iure! Tempora
maxime, et neque natus dolores aliquam hic magni commodi quod a vel
delectus quisquam aperiam cupiditate eaque aspernatur tempore atque
tenetur modi? Exercitationem repellat hic officiis atque aperiam
repellendus et eos quisquam ratione, quidem enim quae sint facere
laudantium amet iure? Dolorum esse autem corrupti explicabo laborum
eum at distinctio dicta aut molestias sunt, totam ab eligendi
possimus. Ipsa, dolorem numquam sint doloribus reprehenderit
laboriosam aperiam alias, culpa recusandae minima assumenda tempore
placeat sunt nesciunt, dolores quidem repudiandae dolor. Ipsa illo, ex
repellat iusto ea fugit sapiente hic, adipisci nam, soluta numquam
error eum neque quos commodi quae a architecto voluptas perspiciatis?
Velit impedit libero ut sit minima exercitationem delectus nobis
quibusdam ab excepturi, soluta maxime ipsum, maiores laudantium iste?
Atque corrupti cupiditate non deserunt alias deleniti delectus numquam
repellendus soluta obcaecati fugit veniam, porro asperiores nesciunt
sed hic esse iusto ipsam provident est praesentium nam eveniet neque
at. Eaque aliquid ipsam vitae. Impedit quas est asperiores sunt
recusandae, iure beatae accusantium quidem quos iste sint sed
architecto eum perferendis dolorum tempora nihil odio error.
</p>
</div>
</main>
</body>
</html>
The lorem is just so I can scroll and see how it looks like :) Sorry for some of the content being in another language aswell
Change the css for html from overflow: hidden-x to overflow:hidden
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
html {
overflow: hidden;
}
body {
background-color: #262626;
font-family: "Roboto Slab", serif;
position: relative;
overflow-x: hidden;
}
main {
width: 100vw;
height: 100vh;
}
#backdrop {
width: 90%;
height: 100%;
margin: 0 auto;
margin-top: 1rem;
border-radius: 1rem 1rem 0 0;
background-color: #727365;
}
#home-link {
color: #f2f2e4;
text-decoration: none;
font-size: 1.7rem;
font-family: "Space Mono", monospace;
font-weight: 400;
position: absolute;
top: 1.95rem;
left: 2.6rem;
}
/* Hamburger menu */
#menu a {
text-decoration: none;
color: #3f403b;
}
#menu a:hover {
color: #0c0c0c;
}
#menu-toggle {
display: block;
position: absolute;
top: 2.5rem;
right: 3rem;
z-index: 1;
}
#menu-checkbox {
display: block;
width: 40px;
height: 32px;
position: absolute;
top: -7px;
left: -5px;
cursor: pointer;
opacity: 0;
z-index: 2;
}
#menu-toggle span {
display: block;
width: 33px;
height: 4px;
margin-bottom: 5px;
position: relative;
background: #f2f2e4;
border-radius: 3px;
z-index: 1;
transform-origin: 4px 0px;
transition: transform 0.5s cubic-bezier(0.77, 0.2, 0.05, 1),
opacity 0.55s ease;
}
#menu-toggle span:first-child {
transform-origin: 0% 0%;
}
#menu-toggle span:nth-last-child(2) {
transform-origin: 0% 100%;
}
#menu-checkbox:checked ~ span {
opacity: 1;
transform: rotate(45deg) translate(-2px, -1px);
background: #3f403b;
}
#menu-checkbox:checked ~ span:nth-last-child(3) {
opacity: 0;
transform: rotate(0deg) scale(0.2, 0.2);
}
#menu-checkbox:checked ~ span:nth-last-child(2) {
opacity: 1;
transform: rotate(-45deg) translate(0, -1px);
}
#menu {
width: 60vw;
height: 70vh;
position: absolute;
right: -100px;
margin: -100px 0 0 0;
padding: 50px;
padding-top: 125px;
border-radius: 1rem;
background-color: #bfbfae;
list-style: none;
transform-origin: 0% 0%;
transform: translate(100%, 0);
transition: transform 0.5s cubic-bezier(0.77, 0.2, 0.05, 1);
}
#menu li {
padding: 10px 0;
font-size: 22px;
}
#menu-checkbox:checked ~ ul {
transform: none;
opacity: 1;
}
/* Scrollbar */
::-webkit-scrollbar {
width: 13px;
}
::-webkit-scrollbar-thumb {
border-radius: 100px;
border: 3px solid transparent;
background-clip: content-box;
background-color: rgb(88, 88, 88);
}
::-webkit-scrollbar-thumb:hover {
background-color: rgb(109, 109, 109);
}
/* Media queries */
#media only screen and (min-width: 600px) {
}
#media only screen and (min-width: 769px) {
#backdrop {
width: 98%;
height: 96.5%;
border-radius: 1rem;
}
#menu-checkbox {
display: none;
}
#menu-toggle span {
display: none;
}
#menu {
-webkit-transition: none !important;
-moz-transition: none !important;
-o-transition: none !important;
transition: none !important;
transform: none !important;
background-color: #bfbfaee1;
padding: 0 1rem 0 1rem;
border-radius: 2rem;
font-family: monospace;
position: fixed;
top: 102vh;
right: 50%;
translate: 50% 0;
height: fit-content;
width: 45vw;
display: flex;
justify-content: space-between;
}
#menu li {
display: inline;
font-size: 1.2rem;
}
#active {
background-color: blue;
border-radius: 3rem;
}
.menu-links {
padding: 8px 35px 8px 35px;
}
#home-link {
display: flex;
justify-content: center;
position: static;
padding-top: 0.5rem;
}
}
<!DOCTYPE html>
<html lang="sv">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>Överdäckningen | Startsida</title>
<link rel="stylesheet" href="css/style.css" />
<script src="script/js.js"></script>
<link
href="https://fonts.googleapis.com/css2?family=Roboto+Slab:wght#200;300;400&display=swap"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css2?family=Space+Mono&display=swap"
rel="stylesheet"
/>
</head>
<body>
<main>
<div id="backdrop">
<header id="wrapper">
<nav>
ÖVERDÄCKNINGEN
<div id="menu-toggle">
<input id="menu-checkbox" type="checkbox" />
<span class="hamburger-span"></span>
<span class="hamburger-span"></span>
<span class="hamburger-span"></span>
<ul id="menu">
<li><a class="menu-links" id="active" href="#">Länk 1</a></li>
<li><a class="menu-links" href="#">Länk 2</a></li>
<li><a class="menu-links" href="#">Länk 3</a></li>
<li><a class="menu-links" href="#">Länk 4</a></li>
</ul>
</div>
</nav>
</header>
</div>
<div>
<p>
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Porro amet
dolores nisi delectus ad inventore laboriosam alias, architecto eos
sunt quod eum maiores provident aspernatur debitis ratione minus
quaerat cumque veniam. Delectus commodi odit molestiae excepturi.
Doloremque rem tempora quod est veritatis earum accusamus vel fugiat
numquam reprehenderit ad labore repudiandae recusandae neque
voluptatum a nulla dignissimos sapiente ut, officiis fugit porro.
Aliquid unde incidunt quisquam. Veniam sunt doloremque modi in
voluptates inventore. In corrupti hic eos, incidunt iusto dignissimos
praesentium ut adipisci possimus officiis nesciunt, eveniet asperiores
illum laudantium aliquid dicta temporibus aut maxime dolor fugit totam
animi velit repudiandae ea? Esse, quod repudiandae amet iusto
temporibus aperiam dolore aliquid, magni sunt eveniet deleniti at
suscipit quasi adipisci, quo officia accusantium repellat nostrum
nemo! Reiciendis repellat omnis facilis qui excepturi assumenda id
laborum vero voluptas, vitae aspernatur eius magnam voluptates iusto,
dolores a fugit tenetur quo nostrum ipsa sequi cumque? Velit voluptate
et at aut iste obcaecati nisi, vitae repellat placeat quasi iusto.
Rerum vero eos earum nobis in inventore quos aliquid id, assumenda
tempora? Modi repudiandae dolorem architecto ut animi doloribus,
tempore possimus nihil ipsum accusamus fugiat laboriosam culpa iure
eum mollitia ab? Quidem quas minus necessitatibus voluptate, rem vero
eligendi possimus totam voluptates laudantium atque illo provident
quasi! Laboriosam quo odio quia in! Commodi voluptatem facilis eos
neque non, magni fugiat numquam consectetur, ipsa dolores ut rerum,
sint sequi quos illo obcaecati omnis harum laudantium error inventore
praesentium. Commodi fugit nostrum asperiores vel ducimus
reprehenderit quis suscipit laborum et fugiat libero eius assumenda
esse nobis, iste, impedit ipsa repudiandae aut aspernatur placeat
inventore! Eligendi sit in obcaecati quia repudiandae explicabo
officia eveniet omnis earum. Quibusdam alias amet quas nobis ullam
vitae enim quod facilis quam maiores! Rem consequatur distinctio
laudantium harum labore, minus qui molestiae suscipit modi libero quia
pariatur maxime hic, voluptate totam numquam, illo beatae voluptatibus
atque ipsa assumenda. Ipsum laudantium, modi nam repellat similique
vitae asperiores corrupti accusamus voluptate maxime harum expedita,
ipsa fugiat obcaecati deserunt porro impedit blanditiis error
reprehenderit temporibus ex at, molestias eius magnam? Voluptatem,
repellat ratione distinctio sit odio assumenda non ad fugit eligendi
nemo eveniet enim porro asperiores, aliquam aliquid? Officia
reiciendis libero tempore cupiditate rem laboriosam odit aspernatur!
Perferendis, id odit. Laudantium, culpa. Iure placeat deserunt
consectetur! Cumque, asperiores itaque nobis laudantium fuga fugit,
nemo autem maiores quo et perferendis laborum illum quis suscipit
eveniet ullam modi. Soluta cum eaque, sequi eveniet deserunt quia odio
officia tenetur vero corrupti labore eum voluptatum quam cumque fuga
hic numquam! Ullam, a dolore omnis nemo beatae at possimus eum
officiis molestiae exercitationem temporibus ab blanditiis voluptatum
reiciendis mollitia maxime perspiciatis harum nostrum officia deleniti
delectus. Hic quos molestias rerum ducimus fugiat consectetur facilis
perspiciatis animi, incidunt error ut tenetur similique unde molestiae
labore perferendis sapiente totam mollitia! Qui, similique ad eos,
cumque laudantium sapiente dolores quas omnis nam fuga exercitationem
blanditiis quaerat aut animi at beatae explicabo nihil adipisci.
Voluptatum qui repudiandae provident ratione, tenetur illum fuga quas
sapiente laborum ipsa obcaecati aut quod perspiciatis, ullam, veniam
explicabo nulla quaerat incidunt quidem! Est odit corrupti quibusdam
doloribus! Vel excepturi voluptatum, nobis voluptatem error
consectetur placeat quibusdam architecto! Molestiae ipsum suscipit est
aperiam veniam nobis laboriosam porro alias, sit eos repellendus
labore, ratione unde ducimus, accusantium illum voluptatum. Tempore,
rem repellat, laboriosam velit aut aliquid ipsa quibusdam consectetur
soluta veniam architecto totam! Reiciendis aliquid vel voluptatem
tempore ea, unde officiis. Corrupti perspiciatis voluptates, suscipit
vero voluptatibus corporis commodi excepturi reprehenderit eos et
nulla voluptatem fuga porro maxime quam eius distinctio, at id aliquid
itaque consequuntur ut repudiandae. Officiis, qui eveniet animi
officia voluptate ipsum, fuga, nisi doloribus in obcaecati quia error
eaque ad cupiditate aliquam alias modi placeat mollitia quibusdam
illum quas aliquid sint? Eligendi, nostrum maiores quas iste
recusandae quae natus impedit consequatur id ipsam dignissimos sequi
excepturi, nobis ducimus dolorum tenetur repellendus praesentium in
dicta atque velit voluptatum quia. Placeat culpa aliquid ab natus
quaerat non quasi cupiditate reprehenderit soluta, unde repellendus
illum, praesentium distinctio blanditiis quod magnam laborum excepturi
iusto molestiae accusamus dolorem nihil. Voluptatum, molestias
debitis? Ipsum veritatis iure suscipit, saepe alias aliquam enim,
officiis deleniti soluta ratione tempora maxime ab beatae autem
accusamus nemo sit, porro dolore illum esse hic. Repudiandae expedita
iste, inventore, officia, ut voluptatibus unde ullam sint debitis enim
ipsa dolorum ducimus quos. Suscipit tenetur ratione sed iure! Tempora
maxime, et neque natus dolores aliquam hic magni commodi quod a vel
delectus quisquam aperiam cupiditate eaque aspernatur tempore atque
tenetur modi? Exercitationem repellat hic officiis atque aperiam
repellendus et eos quisquam ratione, quidem enim quae sint facere
laudantium amet iure? Dolorum esse autem corrupti explicabo laborum
eum at distinctio dicta aut molestias sunt, totam ab eligendi
possimus. Ipsa, dolorem numquam sint doloribus reprehenderit
laboriosam aperiam alias, culpa recusandae minima assumenda tempore
placeat sunt nesciunt, dolores quidem repudiandae dolor. Ipsa illo, ex
repellat iusto ea fugit sapiente hic, adipisci nam, soluta numquam
error eum neque quos commodi quae a architecto voluptas perspiciatis?
Velit impedit libero ut sit minima exercitationem delectus nobis
quibusdam ab excepturi, soluta maxime ipsum, maiores laudantium iste?
Atque corrupti cupiditate non deserunt alias deleniti delectus numquam
repellendus soluta obcaecati fugit veniam, porro asperiores nesciunt
sed hic esse iusto ipsam provident est praesentium nam eveniet neque
at. Eaque aliquid ipsam vitae. Impedit quas est asperiores sunt
recusandae, iure beatae accusantium quidem quos iste sint sed
architecto eum perferendis dolorum tempora nihil odio error.
</p>
</div>
</main>
</body>
</html>
<!-- begin snippet: js hide: false console: true babel: null -->
If you remove the main tag, it should work
This question already has answers here:
Image inside div has extra space below the image
(10 answers)
Closed 1 year ago.
I am a beginner and I am trying to make a webpage. I am using SVG on that webpage. But I am getting a bottom line/padding after the SVG. Here I am giving an image below:
I don't want the gradient color line after the SVG.
My Code:
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
.one {
background: linear-gradient(
60deg,
rgba(84, 58, 183, 1) 0%,
rgba(0, 172, 193, 1) 100%
);
}
<div class="one">
<div class="text">
<h1>Demo Text</h1>
<p>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Numquam autem ipsa aspernatur? Commodi, aut quae soluta eum aliquid adipisci eos natus consequatur provident incidunt fugit mollitia eligendi maxime, porro a cum. Delectus rerum amet doloribus labore iure, quam mollitia voluptatum sit optio minus vero dignissimos minima, necessitatibus obcaecati at ipsa.</p>
</div>
<svg id="wave" style="transform:rotate(0deg); transition: 0.3s" viewBox="0 0 1440 300" version="1.1" xmlns="http://www.w3.org/2000/svg"><defs><linearGradient id="sw-gradient-0" x1="0" x2="0" y1="1" y2="0"><stop stop-color="rgba(255, 255, 255, 1)" offset="0%"></stop><stop stop-color="rgba(255, 255, 255, 1)" offset="100%"></stop></linearGradient></defs><path style="transform:translate(0, 0px); opacity:1" fill="url(#sw-gradient-0)" d="M0,210L80,175C160,140,320,70,480,70C640,70,800,140,960,160C1120,180,1280,150,1440,115C1600,80,1760,40,1920,45C2080,50,2240,100,2400,140C2560,180,2720,210,2880,225C3040,240,3200,240,3360,210C3520,180,3680,120,3840,80C4000,40,4160,20,4320,25C4480,30,4640,60,4800,80C4960,100,5120,110,5280,105C5440,100,5600,80,5760,105C5920,130,6080,200,6240,205C6400,210,6560,150,6720,130C6880,110,7040,130,7200,140C7360,150,7520,150,7680,130C7840,110,8000,70,8160,80C8320,90,8480,150,8640,185C8800,220,8960,230,9120,215C9280,200,9440,160,9600,125C9760,90,9920,60,10080,75C10240,90,10400,150,10560,165C10720,180,10880,150,11040,125C11200,100,11360,80,11440,70L11520,60L11520,300L11440,300C11360,300,11200,300,11040,300C10880,300,10720,300,10560,300C10400,300,10240,300,10080,300C9920,300,9760,300,9600,300C9440,300,9280,300,9120,300C8960,300,8800,300,8640,300C8480,300,8320,300,8160,300C8000,300,7840,300,7680,300C7520,300,7360,300,7200,300C7040,300,6880,300,6720,300C6560,300,6400,300,6240,300C6080,300,5920,300,5760,300C5600,300,5440,300,5280,300C5120,300,4960,300,4800,300C4640,300,4480,300,4320,300C4160,300,4000,300,3840,300C3680,300,3520,300,3360,300C3200,300,3040,300,2880,300C2720,300,2560,300,2400,300C2240,300,2080,300,1920,300C1760,300,1600,300,1440,300C1280,300,1120,300,960,300C800,300,640,300,480,300C320,300,160,300,80,300L0,300Z"></path></svg>
</div>
<div class="two">
<h1>Demo Text</h1>
<p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Eaque, hic labore. Dignissimos labore explicabo, saepe beatae accusamus quos iste dolore repellat blanditiis optio assumenda sequi fugiat cum inventore culpa at voluptatem quisquam? Aperiam voluptates deleniti, iusto aspernatur nulla quam obcaecati consequuntur quis cumque sapiente veritatis accusantium quidem possimus dicta blanditiis.</p>
</div>
How can I remove the bottom line?
Set the svg element to display block. It defaults to inline-block. inline-block reserves space for descenders but you don't want that.
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
.one {
background: linear-gradient(
60deg,
rgba(84, 58, 183, 1) 0%,
rgba(0, 172, 193, 1) 100%
);
}
svg {
display : block;
}
<div class="one">
<div class="text">
<h1>Demo Text</h1>
<p>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Numquam autem ipsa aspernatur? Commodi, aut quae soluta eum aliquid adipisci eos natus consequatur provident incidunt fugit mollitia eligendi maxime, porro a cum. Delectus rerum amet doloribus labore iure, quam mollitia voluptatum sit optio minus vero dignissimos minima, necessitatibus obcaecati at ipsa.</p>
</div>
<svg id="wave" style="transform:rotate(0deg); transition: 0.3s" viewBox="0 0 1440 300" version="1.1" xmlns="http://www.w3.org/2000/svg"><defs><linearGradient id="sw-gradient-0" x1="0" x2="0" y1="1" y2="0"><stop stop-color="rgba(255, 255, 255, 1)" offset="0%"></stop><stop stop-color="rgba(255, 255, 255, 1)" offset="100%"></stop></linearGradient></defs><path style="transform:translate(0, 0px); opacity:1" fill="url(#sw-gradient-0)" d="M0,210L80,175C160,140,320,70,480,70C640,70,800,140,960,160C1120,180,1280,150,1440,115C1600,80,1760,40,1920,45C2080,50,2240,100,2400,140C2560,180,2720,210,2880,225C3040,240,3200,240,3360,210C3520,180,3680,120,3840,80C4000,40,4160,20,4320,25C4480,30,4640,60,4800,80C4960,100,5120,110,5280,105C5440,100,5600,80,5760,105C5920,130,6080,200,6240,205C6400,210,6560,150,6720,130C6880,110,7040,130,7200,140C7360,150,7520,150,7680,130C7840,110,8000,70,8160,80C8320,90,8480,150,8640,185C8800,220,8960,230,9120,215C9280,200,9440,160,9600,125C9760,90,9920,60,10080,75C10240,90,10400,150,10560,165C10720,180,10880,150,11040,125C11200,100,11360,80,11440,70L11520,60L11520,300L11440,300C11360,300,11200,300,11040,300C10880,300,10720,300,10560,300C10400,300,10240,300,10080,300C9920,300,9760,300,9600,300C9440,300,9280,300,9120,300C8960,300,8800,300,8640,300C8480,300,8320,300,8160,300C8000,300,7840,300,7680,300C7520,300,7360,300,7200,300C7040,300,6880,300,6720,300C6560,300,6400,300,6240,300C6080,300,5920,300,5760,300C5600,300,5440,300,5280,300C5120,300,4960,300,4800,300C4640,300,4480,300,4320,300C4160,300,4000,300,3840,300C3680,300,3520,300,3360,300C3200,300,3040,300,2880,300C2720,300,2560,300,2400,300C2240,300,2080,300,1920,300C1760,300,1600,300,1440,300C1280,300,1120,300,960,300C800,300,640,300,480,300C320,300,160,300,80,300L0,300Z"></path></svg>
</div>
<div class="two">
<h1>Demo Text</h1>
<p>Lorem ipsum, dolor sit amet consectetur adipisicing elit. Eaque, hic labore. Dignissimos labore explicabo, saepe beatae accusamus quos iste dolore repellat blanditiis optio assumenda sequi fugiat cum inventore culpa at voluptatem quisquam? Aperiam voluptates deleniti, iusto aspernatur nulla quam obcaecati consequuntur quis cumque sapiente veritatis accusantium quidem possimus dicta blanditiis.</p>
</div>
What I'm trying to do is to add top and bottom shadows to a parent container on content scrolling. It works nicely everywhere except Chrome on retina screens. It behaves weird. When content gets scrolled the background is stuck on top, bottom or both.
.container {
width: 300px;
height: 150px;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
border: 1px solid #eee;
overflow: auto;
background:
linear-gradient(white 30%,rgba(255,255,255,0)),
linear-gradient(rgba(255,255,255,0),white 70%) 0 100%,
radial-gradient(farthest-side at 50% 0,rgba(0,0,0,.3),rgba(0,0,0,0)),
radial-gradient(farthest-side at 50% 100%,rgba(0,0,0,.3),rgba(0,0,0,0)) 0 100%;
background-repeat: no-repeat;
background-color: white;
background-size: 100% 20px,100% 20px,100% 10px,100% 10px;
background-attachment: local,local,scroll,scroll;
}
.content {
padding: 15px 10px;
color: #555;
}
<div class="container">
<div class="content">
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Accusamus iure repellendus tenetur totam possimus reiciendis error beatae nisi eligendi eveniet sit ullam, delectus dolorem voluptatum qui esse quod maxime praesentium cum perspiciatis dignissimos quam vero illum eius quisquam. Fugit ducimus repudiandae nisi corporis illo quo atque, aliquid. Perferendis labore vero quae officia eaque deserunt delectus, ipsa reiciendis vel eveniet, adipisci magni, possimus eum ipsum non laborum. Aspernatur iste, ratione eaque necessitatibus iure ipsum velit nobis quisquam explicabo quis voluptas inventore sapiente veniam, exercitationem assumenda natus eligendi! Soluta omnis blanditiis non dolor voluptates quo, est provident beatae enim id, numquam molestias placeat quibusdam. Facere expedita aliquam natus id nobis dolorem laboriosam omnis saepe, itaque adipisci, deleniti praesentium quidem maiores vitae, enim neque aperiam dolore impedit non illo accusamus ab consequatur quia vel. Fugit fugiat, quis iste sit recusandae maxime earum officiis. Temporibus doloremque quasi odit, voluptate, at, voluptates labore neque nesciunt tenetur voluptatum debitis aliquid delectus? Error architecto porro illo velit autem in voluptates cum accusantium aut maiores quam maxime consequuntur possimus labore commodi odit vero ipsam libero, aliquid iure quod temporibus, molestias delectus. Consectetur obcaecati, rem laborum tempore! Dolorem explicabo nisi accusamus qui soluta amet mollitia laboriosam illum molestias et.
</div>
</div>
I speculate that background-attachment property causes it somehow.
Video: https://monosnap.com/file/uIWzofapTsteYNuv3tkdO9kWM1PjCv
Fixed that by adding pseudo elements to .container and removed 2 unnecessary backgrounds from it.
.container {
width: 300px;
height: 150px;
position: fixed;
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
border: 1px solid #eee;
overflow: auto;
background-color: #fff;
background-repeat: no-repeat;
background-image:
radial-gradient(farthest-side at 50% 0,rgba(0,0,0,.3),rgba(0,0,0,0)),
radial-gradient(farthest-side at 50% 100%,rgba(0,0,0,.3),rgba(0,0,0,0));
background-position: 0 0, 0 100%;
background-size: 100% 10px;
}
.container::before {
content: "";
position: relative;
display: block;
height: 30px;
margin: 0 0 -30px;
background: linear-gradient(to bottom, white, white 30%,rgba(255,255,255,0));
z-index: -1;
}
.container::after {
content: "";
position: relative;
display: block;
height: 30px;
margin: -30px 0 0;
background: linear-gradient(to bottom, rgba(255,255,255,0), white 70%, white);
z-index: -1;
}
.content {
padding: 15px 10px;
color: #555;
}
<div class="container">
<div class="content">
Lorem ipsum dolor sit amet, consectetur adipisicing elit. Accusamus iure repellendus tenetur totam possimus reiciendis error beatae nisi eligendi eveniet sit ullam, delectus dolorem voluptatum qui esse quod maxime praesentium cum perspiciatis dignissimos quam vero illum eius quisquam. Fugit ducimus repudiandae nisi corporis illo quo atque, aliquid. Perferendis labore vero quae officia eaque deserunt delectus, ipsa reiciendis vel eveniet, adipisci magni, possimus eum ipsum non laborum. Aspernatur iste, ratione eaque necessitatibus iure ipsum velit nobis quisquam explicabo quis voluptas inventore sapiente veniam, exercitationem assumenda natus eligendi! Soluta omnis blanditiis non dolor voluptates quo, est provident beatae enim id, numquam molestias placeat quibusdam. Facere expedita aliquam natus id nobis dolorem laboriosam omnis saepe, itaque adipisci, deleniti praesentium quidem maiores vitae, enim neque aperiam dolore impedit non illo accusamus ab consequatur quia vel. Fugit fugiat, quis iste sit recusandae maxime earum officiis. Temporibus doloremque quasi odit, voluptate, at, voluptates labore neque nesciunt tenetur voluptatum debitis aliquid delectus? Error architecto porro illo velit autem in voluptates cum accusantium aut maiores quam maxime consequuntur possimus labore commodi odit vero ipsam libero, aliquid iure quod temporibus, molestias delectus. Consectetur obcaecati, rem laborum tempore! Dolorem explicabo nisi accusamus qui soluta amet mollitia laboriosam illum molestias et.
</div>
</div>