Stack Overflow Asked on December 22, 2021
Here is the codepen showing what is happening https://codepen.io/designextras/pen/abdMwrP
I tried to add overflow: hidden and overflow-x, y but it still didn’t work.
I’m using before and after cause I have two svgs that I need displayed on the right side
.container {
max-width: 100%;
}
.container:before {
content: '';
display: block;
position: absolute;
background: url(images/svg-gradient.svg) no-repeat;
width: 100%;
height: 100%;
max-width: 855px;
top: 0%;
right: -5%;
}
.container:after {
content: '';
display: block;
position: absolute;
background: url(images/dashboard-svg.svg) no-repeat;
width: 100%;
height: 100%;
max-width: 855px;
top: 30%;
right: -10%;
transform: rotate(-20deg);
}
You add this in css AND disable x
srolling,
body {
overflow-x: hidden
}
Add this to .container:before
and .container:after
z-index: -1;
And the complete working thing,
* {
box-sizing: border-box;
margin: 0;
padding: 0;
font-family: 'Montserrat', sans-serif;
}
body {
overflow-x: hidden;
}
nav {
width: 100%;
height: 80px;
display: flex;
justify-content: center;
align-items: center;
position: relative;
}
.container {
max-width: 100%;
max-height: 100vh;
background: yellow;
}
.container:before {
content: '';
z-index: -1;
display: block;
position: absolute;
background: blue;
width: 100%;
height: 100%;
max-width: 855px;
top: 0%;
right: -5%;
}
.container:after {
content: '';
z-index: -1;
display: block;
position: absolute;
background: red;
width: 100%;
height: 100%;
max-width: 855px;
top: 30%;
right: -10%;
transform: rotate(-20deg);
}
.navbar-menu {
display: flex;
justify-content: space-between;
align-items: center;
width: 80%;
height: 80px;
}
#logo {
font-size: 2rem;
font-weight: bold;
text-decoration: none;
color: #2C2C2C;
}
ul {
display: flex;
}
li {
list-style: none;
margin-right: 2rem;
}
a {
text-decoration: none;
color: #000;
}
#btn {
background: #50CDFB;
height: 146px;
width: 130px;
padding: 10px 16px;
border-radius: 4px;
color: #fff;
}
.new-section {
background: red;
height: 500px;
width: 500px;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<link rel="stylesheet" href="style.css">
<link href="https://fonts.googleapis.com/css2?family=Montserrat&display=swap" rel="stylesheet">
</head>
<body>
<div class="container">
<nav>
<div class="navbar-menu">
<a href="#" id="logo">Startup</a>
<ul>
<li><a href="#">Home</a></li>
<li><a href="#">Services</a></li>
<li><a href="#">Pricing</a></li>
<li><a href="#">Contact</a></li>
<li><a href="#" id='btn'>Signup</a></li>
</ul>
</div>
</nav>
<div>New section</div>
</div>
<div>I need to be under everything</div>
</body>
</html>
Answered by aeXuser264 on December 22, 2021
Get help from others!
Recent Answers
Recent Questions
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP