I'm trying to make my website able to scroll down when in 100% but it isn't working, the only way to view the whole page is if I zoom out to 80% Below is all the CSS and HTML. I've tried putting an Overflow:scroll for the main body of the page but it still didn't work. I still had to zoom out to view the page.
#charset "utf-8";
/* CSS Document */
body {
margin: 0;
}
#mainPage {
height: 1000px;
width: 100%;
background-color: #1e1e1e;
position: absolute;
z-index: -5;
}
#navBar {
height: 70px;
width: 100%;
Background-color: #1f1f1f;
position: fixed;
z-index: 1;
}
ul {
margin: 0;
list-style-type: none;
color: white;
display: block;
padding-top: 20px;
padding-left: 350px;
font-family: "Economica", sans-serif;
font-size: 28px;
text-decoration: none;
position: relative;
}
ul li {
display: inline;
text-decoration: none;
}
#Logo {
margin-left: 70px;
border: 0;
background-color: #1f1f1f;
font-family: "Economica";
font-size: 49px;
float: left;
color: white;
margin-top: 5px;
font-weight: bold;
}
#google {
margin-left: 45px;
}
img {
opacity: 0.3;
position: relative;
z-index: -3;
}
a {
text-decoration: none;
color: white;
}
#Events {
top: 120px;
left: 50px;
background-color: black;
width: 245px;
height: 370px;
position: absolute;
border-radius: 21px;
z-index: -2;
}
#eventList {
padding-top: 130px;
padding-left: 30px;
}
.event {
display: block;
padding-top: 10px;
padding-bottom: 10px;
padding-left: 40px;
}
.lines {
width: 200px;
margin: 0;
margin-top: 6px;
margin-bottom: 0;
}
.highlight {
Padding-top: 20px;
padding-bottom: 17px;
padding-left: 44px;
padding-right: 44px;
}
#select a:hover {
background-color: #383838;
transition: ease 0.2s;
}
#eventList a:hover {
background-color: rgba(255, 255, 255, 0.4);
color: #ffe700;
transition: ease 0.7s;
}
.eventLight {
padding-right: 70px;
padding-top: 17px;
border-radius: 6px;
padding-left: 10px;
padding-bottom: 3px;
}
#upComing {
height: 300px;
position: absolute;
padding-left: 450px;
font-family: "economica";
font-size: 65px;
color: white;
padding-top: 175px;
}
#box {
background-color: rgba(255, 255, 255, 0.3);
width: 800px;
height: 195px;
border-radius: 10px;
font-size: 35px;
padding-left: 10px;
}
#entireBox {
width: 810px;
height: 195px;
border-radius: 17px;
border: 5px solid black;
margin-top: 40px;
}
#drake {
background-color: rgba(255, 255, 255, 0.3);
width: 410px;
height: 135px;
border-radius: 10px;
font-family: "economica";
font-size: 35px;
color: white;
padding-left: 15px;
padding-top: 5px;
}
#drakeBorder {
width: 425px;
height: 140px;
border-radius: 15px;
border: 5px solid black;
}
#ovo {
height: 200px;
position: absolute;
padding-left: 450px;
padding-top: 545px;
}
#circle1 {
width: 10px;
height: 10px;
background-color: white;
position: absolute;
margin-left: 485px;
margin-top: 30px;
border: 3px solid black;
border-radius: 50px;
}
#circle1 {
width: 10px;
height: 10px;
background-color: white;
position: absolute;
margin-left: 485px;
margin-top: 30px;
border: 3px solid black;
border-radius: 50px;
}
#circle2 {
width: 10px;
height: 10px;
background-color: white;
position: absolute;
margin-left: 635px;
margin-top: 30px;
border: 3px solid black;
border-radius: 50px;
}
#circle3 {
width: 10px;
height: 10px;
background-color: white;
position: absolute;
margin-left: 829px;
margin-top: 30px;
border: 3px solid black;
border-radius: 50px;
}
#circle4 {
width: 10px;
height: 10px;
background-color: white;
position: absolute;
margin-left: 1010px;
margin-top: 30px;
border: 3px solid black;
border-radius: 50px;
}
#wembley {
position: absolute;
border: 0;
width: 95px;
height: 37px;
margin-top: -27px;
opacity: 1;
}
#mobile {
margin: 0;
margin-top: 0;
width: 250px;
height: 1000px;
background-color: #333333;
margin-left: -600px;
position: absolute;
z-index: -5;
}
.slider {
border: none;
background-color: white;
height: 3px;
width: 45px;
margin-top: 10px;
border-radius: 15px;
transition: ease 1s;
}
#slideButton {
background-color: rgba(255, 255, 255, 0);
border: 0;
margin-top: 12px;
margin-left: 15px;
padding-right: 7px;
padding-top: 7px;
position: fixed;
border-radius: 5px;
padding-left: 18px;
visibility: hidden;
}
#slideButton:focus {
outline: none;
}
#slideButton:hover {
background-color: rgba(100, 100, 100, 0.1);
transition: ease 0.6s;
}
#listMobile {
margin-top: 100px;
margin-left: -318px;
}
.smallList {
display: block;
padding-top: 15px;
padding-bottom: 15px;
padding-left: 0;
font-size: 45px;
}
#line {
position: fixed;
margin-top: 83px;
width: 250px;
border: none;
height: 2px;
background-color: #646464;
}
.rainbow-button {
width: 134px;
height: 70px;
background-image: linear-gradient(90deg, #00C0FF 0%, #FFCF00 49%, #FC4F4F 80%, #00C0FF 100%);
display: flex;
justify-content: center;
font-size: 28px;
margin-left: 350px;
margin-top: 0;
font-family: economica;
position: fixed;
color: #ffe700;
}
.rainbow-button:after {
content: attr(title);
width: 134px;
height: 67px;
background-color: #1f1f1f;
display: flex;
align-items: center;
justify-content: center;
}
.rainbow-button:hover {
background-color: #383838;
animation: slidebg 2s linear infinite;
}
#keyframes slidebg {
to {
background-position: 20vw;
}
}
body {
overflow: hidden;
}
.holder {
width: 500px;
height: 250px;
position: fixed;
margin-top: -220px;
}
.holder .circle {
border-radius: 100% 100% 0 0;
position: absolute;
bottom: 0;
left: 0;
transform: translateX(-50%);
transform-origin: bottom center;
}
.holder .circle:nth-child(1) {
border: 2px solid white;
border-bottom: none;
border-radius: 0px 0px 0 0;
width: 0px;
height: 0px;
z-index: 15;
animation: circle-1 10s infinite ease-in-out;
}
#keyframes circle-1 {
0% {
transform: translateX(-50%) rotate(0deg);
}
100% {
transform: translateX(-50%) rotate(-360deg);
}
}
.holder .circle:nth-child(2) {
border: 2px solid white;
border-bottom: none;
border-radius: 11px 11px 0 0;
width: 11px;
height: 5.5px;
z-index: 14;
animation: circle-2 10s infinite ease-in-out;
}
#keyframes circle-2 {
0% {
transform: translateX(-50%) rotate(0deg);
}
100% {
transform: translateX(-50%) rotate(-720deg);
}
}
.holder .circle:nth-child(3) {
border: 2px solid white;
border-bottom: none;
border-radius: 22px 22px 0 0;
width: 22px;
height: 11px;
z-index: 13;
animation: circle-3 10s infinite ease-in-out;
}
#keyframes circle-3 {
0% {
transform: translateX(-50%) rotate(0deg);
}
100% {
transform: translateX(-50%) rotate(-1080deg);
}
}
.holder .circle:nth-child(4) {
border: 2px solid white;
border-bottom: none;
border-radius: 33px 33px 0 0;
width: 33px;
height: 16.5px;
z-index: 12;
animation: circle-4 10s infinite ease-in-out;
}
#keyframes circle-4 {
0% {
transform: translateX(-50%) rotate(0deg);
}
100% {
transform: translateX(-50%) rotate(-1440deg);
}
}
.holder .circle:nth-child(5) {
border: 2px solid white;
border-bottom: none;
border-radius: 44px 44px 0 0;
width: 44px;
height: 22px;
z-index: 11;
animation: circle-5 10s infinite ease-in-out;
}
#keyframes circle-5 {
0% {
transform: translateX(-50%) rotate(0deg);
}
100% {
transform: translateX(-50%) rotate(-1800deg);
}
}
.holder .circle:nth-child(6) {
border: 2px solid white;
border-bottom: none;
border-radius: 55px 55px 0 0;
width: 55px;
height: 27.5px;
z-index: 10;
animation: circle-6 10s infinite ease-in-out;
}
#keyframes circle-6 {
0% {
transform: translateX(-50%) rotate(0deg);
}
100% {
transform: translateX(-50%) rotate(-2160deg);
}
}
<!doctype html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="IceArenaHome.css">
<title>
Ice Arena
</title>
<link href="https://fonts.googleapis.com/css?family=Economica" rel="stylesheet">
</head>
<body>
<div id="mainPage">
<div id="ovo">
<div id="drakeBorder">
<div id="drake">
Be here when rappers <span style="color:#ffe700;">X</span> and <span style="color:#ffe700;">Y</span> will be performing live on stage.
</div>
</div>
</div>
<div id="upComing">
Upcoming Events:
<div id="entireBox">
<div id="box">
Make sure you are here when <br>these two teams clash in the<span style="opacity:0;">.............<!-- i used these full stops to push my text to the right --> ......</span> <span style="color:#ffe700; font-size:40px;">Manchester United vs Ajax</span><br> biggest match in European <br> football the Europa league final.
</div>
</div>
</div>
<img src="http://xoio.de/wp-content/uploads/2013/08/GMP_Tokyo_Stadium_Concert_interiorvisual_by_xoio1.jpg" alt="concert stadium" style="width:100%; position:absolute; padding-top:70px; height:930px">
<div id="navBar">
<div id="circle1" class="circles">
</div>
<div id="circle2" class="circles">
</div>
<div id="circle3" class="circles">
</div>
<div id="circle4" class="circles">
</div>
<div id="Logo">
<div class="holder">
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
</div> <span id="google">Ice Arena</span>
</div>
<ul id="select">
<li>
<a class="highlight" style="color:#ffe700;">Home
</a> </li>
<li><a class="highlight" href="IceArenaGallery.html">
Gallery
</a> </li>
<li> <a class="highlight" href="IceArenaOrderForm.html">
Order Form
</a> </li>
<li> <a class="highlight" href="#">
The Arena
</a></li>
<li><a class="highlight" href="#">
Contact Us
</a> </li>
</ul>
</div>
<ul id="eventList">
<li class="event"><a class="eventLight" href="#">
All<strong style="opacity:0;">.....................</strong>
</a>
<hr class="lines">
</li>
<li class="event"><a class="eventLight" href="#">
Sports <strong style="opacity:0;">.............</strong>
</a>
<hr class="lines"> </li>
<li class="event"><a class="eventLight" href="#">
Music<strong style="opacity:0;">...............</strong>
</a>
<hr class="lines">
</li>
<li class="event"><a class="eventLight" href="#">
Family<strong style="opacity:0;">..............</strong>
</a>
<hr class="lines">
</li>
<li class="event"><a class="eventLight" href="#">
Comedy<strong style="opacity:0;">............</strong>
</a>
<hr class="lines"> </li>
<li class="event"><a class="eventLight" href="#">
Performance<strong style="opacity:0;">...</strong>
</a></li>
</ul>
<div id="Events" style="opacity:0.4;">
</div>
</div>
</body>
</html>
Try add:
html{
overflow-y: scroll;
}
Css 'overflow-y: scroll' creates scroll, as you expects.
#charset "utf-8";
/* CSS Document */
body {
margin: 0;
}
html {
overflow-y: scroll;
}
#mainPage {
height: 1000px;
width: 100%;
background-color: #1e1e1e;
position: absolute;
z-index: -5;
}
#navBar {
height: 70px;
width: 100%;
Background-color: #1f1f1f;
position: fixed;
z-index: 1;
}
ul {
margin: 0;
list-style-type: none;
color: white;
display: block;
padding-top: 20px;
padding-left: 350px;
font-family: "Economica", sans-serif;
font-size: 28px;
text-decoration: none;
position: relative;
}
ul li {
display: inline;
text-decoration: none;
}
#Logo {
margin-left: 70px;
border: 0;
background-color: #1f1f1f;
font-family: "Economica";
font-size: 49px;
float: left;
color: white;
margin-top: 5px;
font-weight: bold;
}
#google {
margin-left: 45px;
}
img {
opacity: 0.3;
position: relative;
z-index: -3;
}
a {
text-decoration: none;
color: white;
}
#Events {
top: 120px;
left: 50px;
background-color: black;
width: 245px;
height: 370px;
position: absolute;
border-radius: 21px;
z-index: -2;
}
#eventList {
padding-top: 130px;
padding-left: 30px;
}
.event {
display: block;
padding-top: 10px;
padding-bottom: 10px;
padding-left: 40px;
}
.lines {
width: 200px;
margin: 0;
margin-top: 6px;
margin-bottom: 0;
}
.highlight {
Padding-top: 20px;
padding-bottom: 17px;
padding-left: 44px;
padding-right: 44px;
}
#select a:hover {
background-color: #383838;
transition: ease 0.2s;
}
#eventList a:hover {
background-color: rgba(255, 255, 255, 0.4);
color: #ffe700;
transition: ease 0.7s;
}
.eventLight {
padding-right: 70px;
padding-top: 17px;
border-radius: 6px;
padding-left: 10px;
padding-bottom: 3px;
}
#upComing {
height: 300px;
position: absolute;
padding-left: 450px;
font-family: "economica";
font-size: 65px;
color: white;
padding-top: 175px;
}
#box {
background-color: rgba(255, 255, 255, 0.3);
width: 800px;
height: 195px;
border-radius: 10px;
font-size: 35px;
padding-left: 10px;
}
#entireBox {
width: 810px;
height: 195px;
border-radius: 17px;
border: 5px solid black;
margin-top: 40px;
}
#drake {
background-color: rgba(255, 255, 255, 0.3);
width: 410px;
height: 135px;
border-radius: 10px;
font-family: "economica";
font-size: 35px;
color: white;
padding-left: 15px;
padding-top: 5px;
}
#drakeBorder {
width: 425px;
height: 140px;
border-radius: 15px;
border: 5px solid black;
}
#ovo {
height: 200px;
position: absolute;
padding-left: 450px;
padding-top: 545px;
}
#circle1 {
width: 10px;
height: 10px;
background-color: white;
position: absolute;
margin-left: 485px;
margin-top: 30px;
border: 3px solid black;
border-radius: 50px;
}
#circle1 {
width: 10px;
height: 10px;
background-color: white;
position: absolute;
margin-left: 485px;
margin-top: 30px;
border: 3px solid black;
border-radius: 50px;
}
#circle2 {
width: 10px;
height: 10px;
background-color: white;
position: absolute;
margin-left: 635px;
margin-top: 30px;
border: 3px solid black;
border-radius: 50px;
}
#circle3 {
width: 10px;
height: 10px;
background-color: white;
position: absolute;
margin-left: 829px;
margin-top: 30px;
border: 3px solid black;
border-radius: 50px;
}
#circle4 {
width: 10px;
height: 10px;
background-color: white;
position: absolute;
margin-left: 1010px;
margin-top: 30px;
border: 3px solid black;
border-radius: 50px;
}
#wembley {
position: absolute;
border: 0;
width: 95px;
height: 37px;
margin-top: -27px;
opacity: 1;
}
#mobile {
margin: 0;
margin-top: 0;
width: 250px;
height: 1000px;
background-color: #333333;
margin-left: -600px;
position: absolute;
z-index: -5;
}
.slider {
border: none;
background-color: white;
height: 3px;
width: 45px;
margin-top: 10px;
border-radius: 15px;
transition: ease 1s;
}
#slideButton {
background-color: rgba(255, 255, 255, 0);
border: 0;
margin-top: 12px;
margin-left: 15px;
padding-right: 7px;
padding-top: 7px;
position: fixed;
border-radius: 5px;
padding-left: 18px;
visibility: hidden;
}
#slideButton:focus {
outline: none;
}
#slideButton:hover {
background-color: rgba(100, 100, 100, 0.1);
transition: ease 0.6s;
}
#listMobile {
margin-top: 100px;
margin-left: -318px;
}
.smallList {
display: block;
padding-top: 15px;
padding-bottom: 15px;
padding-left: 0;
font-size: 45px;
}
#line {
position: fixed;
margin-top: 83px;
width: 250px;
border: none;
height: 2px;
background-color: #646464;
}
.rainbow-button {
width: 134px;
height: 70px;
background-image: linear-gradient(90deg, #00C0FF 0%, #FFCF00 49%, #FC4F4F 80%, #00C0FF 100%);
display: flex;
justify-content: center;
font-size: 28px;
margin-left: 350px;
margin-top: 0;
font-family: economica;
position: fixed;
color: #ffe700;
}
.rainbow-button:after {
content: attr(title);
width: 134px;
height: 67px;
background-color: #1f1f1f;
display: flex;
align-items: center;
justify-content: center;
}
.rainbow-button:hover {
background-color: #383838;
animation: slidebg 2s linear infinite;
}
#keyframes slidebg {
to {
background-position: 20vw;
}
}
body {
overflow: hidden;
}
.holder {
width: 500px;
height: 250px;
position: fixed;
margin-top: -220px;
}
.holder .circle {
border-radius: 100% 100% 0 0;
position: absolute;
bottom: 0;
left: 0;
transform: translateX(-50%);
transform-origin: bottom center;
}
.holder .circle:nth-child(1) {
border: 2px solid white;
border-bottom: none;
border-radius: 0px 0px 0 0;
width: 0px;
height: 0px;
z-index: 15;
animation: circle-1 10s infinite ease-in-out;
}
#keyframes circle-1 {
0% {
transform: translateX(-50%) rotate(0deg);
}
100% {
transform: translateX(-50%) rotate(-360deg);
}
}
.holder .circle:nth-child(2) {
border: 2px solid white;
border-bottom: none;
border-radius: 11px 11px 0 0;
width: 11px;
height: 5.5px;
z-index: 14;
animation: circle-2 10s infinite ease-in-out;
}
#keyframes circle-2 {
0% {
transform: translateX(-50%) rotate(0deg);
}
100% {
transform: translateX(-50%) rotate(-720deg);
}
}
.holder .circle:nth-child(3) {
border: 2px solid white;
border-bottom: none;
border-radius: 22px 22px 0 0;
width: 22px;
height: 11px;
z-index: 13;
animation: circle-3 10s infinite ease-in-out;
}
#keyframes circle-3 {
0% {
transform: translateX(-50%) rotate(0deg);
}
100% {
transform: translateX(-50%) rotate(-1080deg);
}
}
.holder .circle:nth-child(4) {
border: 2px solid white;
border-bottom: none;
border-radius: 33px 33px 0 0;
width: 33px;
height: 16.5px;
z-index: 12;
animation: circle-4 10s infinite ease-in-out;
}
#keyframes circle-4 {
0% {
transform: translateX(-50%) rotate(0deg);
}
100% {
transform: translateX(-50%) rotate(-1440deg);
}
}
.holder .circle:nth-child(5) {
border: 2px solid white;
border-bottom: none;
border-radius: 44px 44px 0 0;
width: 44px;
height: 22px;
z-index: 11;
animation: circle-5 10s infinite ease-in-out;
}
#keyframes circle-5 {
0% {
transform: translateX(-50%) rotate(0deg);
}
100% {
transform: translateX(-50%) rotate(-1800deg);
}
}
.holder .circle:nth-child(6) {
border: 2px solid white;
border-bottom: none;
border-radius: 55px 55px 0 0;
width: 55px;
height: 27.5px;
z-index: 10;
animation: circle-6 10s infinite ease-in-out;
}
#keyframes circle-6 {
0% {
transform: translateX(-50%) rotate(0deg);
}
100% {
transform: translateX(-50%) rotate(-2160deg);
}
}
<!doctype html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="IceArenaHome.css">
<title>
Ice Arena
</title>
<link href="https://fonts.googleapis.com/css?family=Economica" rel="stylesheet">
</head>
<body>
<div id="mainPage">
<div id="ovo">
<div id="drakeBorder">
<div id="drake">
Be here when rappers <span style="color:#ffe700;">X</span> and <span style="color:#ffe700;">Y</span> will be performing live on stage.
</div>
</div>
</div>
<div id="upComing">
Upcoming Events:
<div id="entireBox">
<div id="box">
Make sure you are here when <br>these two teams clash in the<span style="opacity:0;">.............<!-- i used these full stops to push my text to the right --> ......</span> <span style="color:#ffe700; font-size:40px;">Manchester United vs Ajax</span><br> biggest match in European <br> football the Europa league final.
</div>
</div>
</div>
<img src="http://xoio.de/wp-content/uploads/2013/08/GMP_Tokyo_Stadium_Concert_interiorvisual_by_xoio1.jpg" alt="concert stadium" style="width:100%; position:absolute; padding-top:70px; height:930px">
<div id="navBar">
<div id="circle1" class="circles">
</div>
<div id="circle2" class="circles">
</div>
<div id="circle3" class="circles">
</div>
<div id="circle4" class="circles">
</div>
<div id="Logo">
<div class="holder">
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
<div class="circle"></div>
</div> <span id="google">Ice Arena</span>
</div>
<ul id="select">
<li>
<a class="highlight" style="color:#ffe700;">Home
</a> </li>
<li><a class="highlight" href="IceArenaGallery.html">
Gallery
</a> </li>
<li> <a class="highlight" href="IceArenaOrderForm.html">
Order Form
</a> </li>
<li> <a class="highlight" href="#">
The Arena
</a></li>
<li><a class="highlight" href="#">
Contact Us
</a> </li>
</ul>
</div>
<ul id="eventList">
<li class="event"><a class="eventLight" href="#">
All<strong style="opacity:0;">.....................</strong>
</a>
<hr class="lines">
</li>
<li class="event"><a class="eventLight" href="#">
Sports <strong style="opacity:0;">.............</strong>
</a>
<hr class="lines"> </li>
<li class="event"><a class="eventLight" href="#">
Music<strong style="opacity:0;">...............</strong>
</a>
<hr class="lines">
</li>
<li class="event"><a class="eventLight" href="#">
Family<strong style="opacity:0;">..............</strong>
</a>
<hr class="lines">
</li>
<li class="event"><a class="eventLight" href="#">
Comedy<strong style="opacity:0;">............</strong>
</a>
<hr class="lines"> </li>
<li class="event"><a class="eventLight" href="#">
Performance<strong style="opacity:0;">...</strong>
</a></li>
</ul>
<div id="Events" style="opacity:0.4;">
</div>
</div>
</body>
</html>
Related
When I try to set the position of a button as "relative" in this specific web.
the width of the page gets increased as you can see by the code provided in snippet, will appreciate if you take a look (Specifically "btn-links1 & btn-links2" classes)
(Absolute value doesn't work as the buttons get misplaced when minimizing the browser window)
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
:root {
--main-color: #00C9A6;
--second-color: #27242B;
--third-color: #545058;
--fourth-color: #FAEAFF;
}
html {
scroll-behavior: smooth;
}
body {
background-color: var(--third-color);
font-family: 'Roboto', sans-serif;
}
.nav-bar {
-webkit-backdrop-filter: blur(8px);
backdrop-filter: blur(8px);
display: flex;
position: fixed;
padding: 15px;
/* background-color: var(--second-color); */
width: 100%;
height: 60px;
z-index: 1030;
}
.active {
border-bottom: 1px solid var(--fourth-color);
}
.logo {
position: relative;
bottom: 4px;
height: 40px;
display: inline-block;
background-color: var(--fourth-color);
transition: .2s;
}
.logo img {
width: 50px;
}
.logo:hover {
opacity: .5;
}
.nav-bar .links li {
padding: 7px;
display: inline-block;
justify-content: space-around;
}
.nav-bar .links {
left: 30px;
position: relative;
/* margin: 10px 0; */
}
.nav-bar .links li a {
list-style: none;
text-decoration: none;
margin-top: 15px;
padding: 0 15px 0 15px;
color: var(--main-color);
text-transform: capitalize;
font-weight: 700;
transition: .2s ease-in-out;
}
.nav-bar .links li:hover a {
color: #00c9a7b9;
}
#home {
position: relative;
width: 100%;
height: 500px;
background-color: var(--third-color);
z-index: 1;
}
.img{
background-image: url(../imgs/Dustin+vs+Claudio_.jpg);
position: absolute;
background-size: cover;
width: 100%;
height: 500px;
z-index: 2;
}
.overlay {
position: absolute;
width: 100%;
height: 500px;
background-color: rgba(33, 31, 35, 0.569);
z-index: 3;
}
.titles h1 {
position: absolute;
font-size: 100px;
font-style: italic;
color: var(--main-color);
z-index: 4;
text-align: center;
top: 0;
left: 170px;
margin: 155px 0;
padding: 5px;
text-transform: capitalize;
}
/* start Button styling */
.btn-link1 {
position: relative;
left: 297px;
bottom: 208px;
text-decoration: none;
}
.btn-link1 a{
position: absolute;
width: 0;
text-decoration: none;
}
.button-86 {
all: unset;
width: 100px;
height: 30px;
font-size: 16px;
background: transparent;
border: none;
position: relative;
color: var(--third-color);
cursor: pointer;
z-index: 1;
padding: 10px 20px;
display: flex;
align-items: center;
justify-content: center;
white-space: nowrap;
user-select: none;
-webkit-user-select: none;
touch-action: manipulation;
}
.button-86::after,
.button-86::before {
content: '';
position: absolute;
bottom: 0;
right: 0;
z-index: -99999;
transition: all .4s;
}
.button-86::before {
transform: translate(0%, 0%);
width: 100%;
height: 100%;
background: var(--fourth-color);
border-radius: 10px;
}
.button-86::after {
transform: translate(10px, 10px);
width: 35px;
height: 35px;
background: #ffffff15;
backdrop-filter: blur(5px);
-webkit-backdrop-filter: blur(5px);
border-radius: 50px;
}
.button-86:hover::before {
transform: translate(5%, 20%);
width: 110%;
height: 110%;
background-color: var(--main-color);
}
.button-86:hover::after {
border-radius: 10px;
transform: translate(0, 0);
width: 100%;
height: 100%;
}
.button-86:active::after {
transition: 0s;
transform: translate(0, 5%);
}
.btn-link1 a span {
font-weight: bold;
transition: all .3s ease-in 0s;
}
.btn-link1:hover a span {
/* font-weight: bold; */
color: black;
}
.btn-link1:hover .fa-instagram {
color: black;
}
.fa-instagram {
/* font-weight: bold; */
color: rgb(120, 5, 221);
margin: 5px;
transition: all .3s ease-in 0s;
}
/* end Button instagram styling */
/* start Button linked in styling */
.btn-link2 {
position: relative;
left: 575px;
bottom: 208px;
text-decoration: none;
}
.btn-link2 a{
position: absolute;
width: 0;
text-decoration: none;
}
.button-87 {
all: unset;
width: 100px;
height: 30px;
font-size: 16px;
background: transparent;
border: none;
position: relative;
color: var(--third-color);
cursor: pointer;
z-index: 1;
padding: 10px 20px;
display: flex;
align-items: center;
justify-content: center;
white-space: nowrap;
user-select: none;
-webkit-user-select: none;
touch-action: manipulation;
}
.button-87::after,
.button-87::before {
content: '';
position: absolute;
bottom: 0;
right: 0;
z-index: -99999;
transition: all .4s;
}
.button-87::before {
transform: translate(0%, 0%);
width: 100%;
height: 100%;
background: var(--fourth-color);
border-radius: 10px;
}
.button-87::after {
transform: translate(10px, 10px);
width: 35px;
height: 35px;
background: #ffffff15;
backdrop-filter: blur(5px);
-webkit-backdrop-filter: blur(5px);
border-radius: 50px;
}
.button-87:hover::before {
transform: translate(5%, 20%);
width: 110%;
height: 110%;
background-color: var(--main-color);
}
.button-87:hover::after {
border-radius: 10px;
transform: translate(0, 0);
width: 100%;
height: 100%;
}
.button-87:active::after {
transition: 0s;
transform: translate(0, 5%);
}
.btn-link2 a span {
font-weight: bold;
transition: all .3s ease-in 0s;
}
.btn-link2:hover a span {
/* font-weight: bold; */
color: rgb(0, 162, 255);
}
.btn-link2:hover .fa-linkedin {
color: black;
}
.fa-linkedin {
color: rgb(0, 162, 255);
margin: 5px;
transition: all .3s ease-in 0s;
}
/* end Button linked in styling */
<div class="nav-bar">
<a class="logo" href="#home">
<img src="imgs/lw-logo.png" alt="">
</a>
<ul class="links">
<li class="active">home</li>
<li>portraits</li>
<li>behind the scenes</li>
<li>action</li>
<li>fine art</li>
<li>contact me</li>
</ul>
</div>
<div id="home">
<div class="background">
<div class="img"></div>
<div class="overlay"></div>
</div>
<div class="titles">
<h1>lw photography</h1>
</div>
</div>
<div class="btn-link1">
<a href="https://www.instagram.com">
<button class="button-86" role="button">
<i class="fa-brands fa-instagram"></i>
<span>Instagram</span>
</button>
</a>
</div>
<div class="btn-link2">
<a href="https://www.linkedin.com/in/lane-walbert-0b838a9a/">
<button class="button-87" role="button">
<i class="fa-brands fa-linkedin"></i>
<span>LinkedIn</span>
</button>
</a>
</div>
Scroll bar down bottom as page width got increased
body {
font-family: Bahnschrift SemiBold, sans-serif;
background-color: #fcfefe;
width: 100%;
height: 100%;
overflow-x: hidden;
}
*{
margin:0; padding: 0;
}
.logonav{
position: top;
left: 0px;
width: 250px;
height: 65px;
padding-top: 70px;
padding-bottom: 20px;
padding-left: 40px;
}
.content{
position: absolute;
bottom: 330px;
left: 30px;
text-align: justify;
font-size: 20px;
font-family: 'Titillium Web', sans-serif;
color: #ffffff;
}
.bn632-hover {
position: absolute;
bottom: 200px;
left: 1200px;
width: 160px;
font-size: 16px;
font-weight: 600;
color: #00bbf0;
cursor: pointer;
margin: 20px;
height: 55px;
text-align:center;
color: whitesmoke;
border: none;
background-size: 300% 100%;
border-radius: 50px;
moz-transition: all .4s ease-in-out;
-o-transition: all .4s ease-in-out;
-webkit-transition: all .4s ease-in-out;
transition: all .4s ease-in-out;
}
.bn632-hover:hover {
background-position: 100% 0;
moz-transition: all .4s ease-in-out;
-o-transition: all .4s ease-in-out;
-webkit-transition: all .4s ease-in-out;
transition: all .4s ease-in-out;
}
.bn632-hover:focus {
outline: none;
}
.bn632-hover.bn18 {
background-image: linear-gradient(
to right,
#25aae1,
#00bbf0,
#00bbf0,
#00bbf0
);
box-shadow: 0 4px 15px 0 rgba(49, 196, 190, 0.75);
}
.image_container.img{
max-height: 100vh;
max-width: 100%;
object-fit: cover;
object-position: bottom;
}
.pozadina{
background-color: #83a3c7;
background-image: url("womandoctor.jpg");
background-size: cover;
width: 110%;
background-blend-mode: normal;
position: relative;
padding-top: 450px;
padding-bottom: 100px;
}
.hornav1{
overflow: hidden;
width: 100%;
background-color: #00bbf0;
list-style-type: none;
margin: 0px;
padding: 0px;
border-bottom: solid 2px #eaf6f6;
size: 100px;
position:fixed;
top:0;
z-index:100;
}
.hornav1 a{
float: right;
color: whitesmoke;
text-align: center;
padding: 14px 16px;
text-decoration: none;
font-size: 17px;
box-sizing: border-box;
margin-left: 5px 10 px;
}
.hornav1 i{
color: whitesmoke;
}
#pocetna{
padding-right: 1000px;
font-size: 20px;
}
.hornav2{
overflow: hidden;
width: 100%;
background-color: #ffffff;
list-style-type: none;
margin: 0px;
padding: 0px;
position: sticky;
top: 0px;
border-bottom: solid 2px #eaf6f6;
}
.hornav2 a{
float: right;
color: #333;
text-align: center;
padding: 14px 16px;
font-size: 17px;
box-sizing: border-box;
margin-left: 5px 10 px;
}
.hornav3{
overflow: hidden;
width: 100%;
background-color: #00bbf0;
list-style-type: none;
margin: 0px;
padding: 10px;
position:sticky;
border-bottom: solid 2px #eaf6f6;
size: 150px;
}
.hornav3 a{
position: relative;
color: whitesmoke;
text-align: center;
padding-left: 50px;
text-decoration: none;
font-size: 24px;
box-sizing: border-box;
right : -270px;
}
.navcontainer{
top:0;
width:100%;
z-index:100;
}
.hornav3 a::before{
content: '';
position: absolute;
bottom: 0;
right: 0;
width: 0;
height: 2px;
background-color: whitesmoke;
transition: width 0.6s cubic-bezier(0.5, 1, 0.5, 1);
}
#media (hover: hover) and (pointer: fine) {
.hornav3 a:hover::before{
left: 0.5;
right: auto;
width: 70%;
}
}
.pregledi{
background-color: #fafafa;
}
.pregledi .heading{
padding-top: 40px;
text-transform: uppercase;
color: deepskyblue;
text-align: center;
font-size: 35px;
}
.pregledi .heading2{
padding-top: 5px;
text-align: center;
font-size: 20px;
font-family: unset;
color: #2c5d63;
}
.pregledi .box-container{
padding-top: 30px;
display: grid;
grid-template-columns: repeat(auto-fit, minmax(20rem, 7fr));
gap:4rem;
margin-left: 60px;
margin-right: 30px;
}
.pregledi .box-container .box h3{
padding-top: 10px;
color: deepskyblue;
text-transform: uppercase;
font-size: 2.1rem;
}
.pregledi .box-container .box p{
padding-top: 10px;
font-family: sans-serif;
font-size: 1rem;
line-height: 1;
}
.pregledi .box-container .box a{
position: relative;
top: 10px;
}
.bn111 {
margin-top: 10px;
padding: 1.3em 0.01em;
font-size: 12px;
text-transform: uppercase;
text-indent: 10px;
letter-spacing: 2.5px;
font-weight: 500;
color: #ffffff;
background-color: #00bbf0;
border: none;
border-radius: 45px;
box-shadow: 0px 8px 15px rgba(0, 0, 0, 0.1);
transition: all 0.24s ease 0s;
cursor: pointer;
outline: none;
}
.bn111:hover {
background-color: #00bbf0;
box-shadow: 0px 15px 20px rgba(34, 180, 255, 0.4);
color: #ffffff;
transform: translateX(7px) translateY(-1.1px);
}
.bn111:active {
transform: translateY(-1px);
}
.bn111 i{
color: #ffffff;
font-size: 1.3em;
padding-right: 4px;
}
.izborna{
background-color: #83a3c7;
background-size: cover;
width: 100%;
background-blend-mode: normal;
opacity: 1;
display: block;
height: auto;
transition: .5s ease;
backface-visibility: hidden;
}
.containerslike{
position: relative;
width: 100%;
max-width: 400px;
}
.overlay {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
height: 100%;
width: 100%;
opacity: 0;
transition: .3s ease;
background-color: #ececec;
}
.containerslike:hover .overlay {
opacity: 0.5;
}
.ikona {
color: deepskyblue;
font-size: 40px;
position: absolute;
top: 100%;
left: 45%;;
transform: translate(-50%, -50%);
-ms-transform: translate(-50%, -50%);
text-align: center;
opacity: 1;
}
.fa-magnifying-glass{
position: absolute;
top: 100px;
}
.bn112 {
margin-top: 10px;
padding: 1.3em 0.01em;
font-size: 18px;
text-transform: uppercase;
text-indent: 10px;
letter-spacing: 2.5px;
font-weight: 500;
color: #ffffff;
background-color: #00bbf0;
border: none;
border-radius: 45px;
box-shadow: 0px 8px 15px rgba(0, 0, 0, 0.1);
transition: all 0.24s ease 0s;
cursor: pointer;
outline: none;
width: 400px;
}
.bn112:hover {
background-color: #00bbf0;
box-shadow: 0px 15px 20px rgba(34, 180, 255, 0.4);
color: #ffffff;
transform: translateY(-1.1px);
}
.bn112:active {
transform: translateY(-1px);
}
.bn112 i{
color: #ffffff;
font-size: 1.3em;
padding-right: 4px;
}
.podnopregled{
margin-left: 500px;
}
.infodiv{
margin-top: 30px;
background-color: deepskyblue;
}
.row {
display: flex;
width: 100%;
}
.noMargin {
margin: 1px;
}
.one {
background-color: #79c2d0;
border: solid #ececec;
height: 300px;
width: 100%;
border-radius: 15px;
margin-top: 30px;
}
.two {
background-color: #79c2d0;
border: solid #ececec;
height: 300px;
width: 100%;
border-radius: 15px;
margin-top: 30px;
}
.three {
background-color: #79c2d0;
border: solid #ececec;
height: 300px;
width: 100%;
border-radius: 15px;
margin-top: 10px;
}
.four {
background-color: #79c2d0;
border: solid #ececec;
height: 300px;
width: 100%;
border-radius: 15px;
margin-top: 10px;
}
.noMargin p{
text-align: center;
margin-top: 100px;
}
#media only screen and (max-width:800px) {
/* For tablets: */
.main {
width: 80%;
padding: 0;
}
.right {
width: 100%;
}
}
#media only screen and (max-width:500px) {
/* For mobile phones: */
.menu, .main, .right {
width: 100%;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>VivaMed medicina rada i sporta</title>
<script src="https://kit.fontawesome.com/60681a69ff.js" crossorigin="anonymous"></script>
<link rel="stylesheet" type="text/css" href="VivamedCSS.css">
<link href="https://fonts.googleapis.com/css2?family=Titillium+Web:wght#300&display=swap" rel="stylesheet">
</head>
<body>
<div class="navcontainer">
<div class="hornav1">
<i class="fas fa-envelope" style="font-size:20px;"></i> info#vivamed.hr
<i class="fa-solid fa-phone"style="font-size:20px;" ></i> +385 1 233 55 00
Početna
</div>
<div class="hornav2">
<img src="vivalogo.webp" alt="logo" class="logonav">
<a class="active" style="font-size: 20px; padding-right: 550px; padding-top: 100px; font-family: 'Titillium Web', sans-serif; font-style: italic; font-weight: bolder;"> Zdrav radnik je uspješan i produktivan radnik.</a>
</div>
<div class="hornav3">
<a class="active" href="https://www.vivamed.hr/kontakt"><i class="fas fa-envelope" style="font-size:20px;"></i> Kontakt</a>
<a class="active" href="https://www.vivamed.hr/kontakt"><i class="fas fa-cloud" style="font-size:20px; color: whitesmoke;"></i> Kontakt</a>
<a class="active" href="https://www.vivamed.hr/kontakt"><i class="fas fa-comment" style="font-size:20px;"></i> Kontakt</a>
<a class="active" href="https://www.vivamed.hr/kontakt"><i class="fas fa-car" style="font-size:20px;"></i> Kontakt</a>
<a class="active" href="https://www.vivamed.hr/galerija"><i class="fas fa-bolt" style="font-size:20px;"></i> O nama</a>
<a class="active" href="file:///C:/Users/Admin/Desktop/Vivamed/VIVAMED%20JEDAN.html#slide-2"><i class="fas fa-envelope"></i> Početna</a>
</div>
</div>
<div class="pozadina">
<div class="content">
<h3>Dobro došli na stranicu Medicine rada i sporta VivaMed!</h3>
<p>Pogledajte sve profesionalne usluge koje nudi
<br>naš tim vrhunskih i renomiranih stručnjaka!
</p>
</div>
<button class="bn632-hover bn18">Naručite se!</button>
</div>
<section class="pregledi" id="pregledi">
<h1 class="heading"> <span> Stručno, brzo i povoljno! </span> </h1>
<h2 class="heading2"> <span>Izdvojeni pregledi</span></h3>
<div class="box-container">
<div class="box">
<div class="containerslike">
<img src="pexels-pixabay-262524.jpg" class="izborna">
<div class="overlay">
<a href="https://www.vivamed.hr/usluge/pregledi" class="ikona">
<i class="fa-solid fa-magnifying-glass"></i>
</a>
</div>
</div>
<h3>Pregled sportaša</h3>
<p>Rekreativci, amateri, profesionalci</p>
<button class="bn111" id="bn111"> Opširnije<i class="fa-solid fa-arrow-right"></i></button>
</div>
<div class="box">
<div class="containerslike">
<img src="delivery-driver-smiling-camera-his-van_13339-235836.jpg" class="izborna">
<div class="overlay">
<a href="https://www.vivamed.hr/usluge/pregledi" class="ikona">
<i class="fa-solid fa-magnifying-glass"></i>
</a>
</div>
</div>
<h3>Pregled vozača</h3>
<p>Sve vrste kategorija i pregleda</p>
<button class="bn111" id="bn111"> Opširnije<i class="fa-solid fa-arrow-right"></i></button>
</div>
<div class="box">
<div class="containerslike">
<img src="happy-graduate-woman-mantle-rejoicing-laughing-smiling_176420-14226.webp" class="izborna">
<div class="overlay">
<a href="https://www.vivamed.hr/usluge/pregledi" class="ikona">
<i class="fa-solid fa-magnifying-glass"></i>
</a>
</div>
</div>
<h3>Učenici i studenti</h3>
<p>Upisi u srednje škole, fakultete i druge akadamske ustanove</p>
<button class="bn111" id="bn111"> Opširnije<i class="fa-solid fa-arrow-right"></i></button>
</div>
<div class="podnopregled">
<button class="bn112" id="bn112"> Svi pregledi<i class="fa-solid fa-arrow-right"></i></button>
</div>
</div>
</section>
<!--
-->
<div class="infodiv">
<div class="row noMargin">
<div class="one">
<p>Radno vrijeme<br>
ponedjeljak 07 - 15
utorak 07 - 18
srijeda 07 - 14
četvrtak 07 - 14
petak 07 - 14
i prema dogovoru </p>
</div>
<div class="two">
<p>Adresa<br>
Krešićeva ul. 32/1. Kat (okretište tramvaja Borongaj)</p>
</div>
</div>
<div class="row noMargin">
<div class="three">
<p>Email<br>
info#vivamed.hr</p>
</div>
<div class="four">
<p>Telefon<br>
+385 1 233 55 00</p>
</div>
</div>
</div>
</body>
</html>
I've been coding a website in html,css and used some javascript scripts to do it. It is a medical website and so far I've done a lot to the main page which is my main problem here. I am self-taught and all the paddings, margins and screen-fits that I've coded into it are were actually applying only to the screen size that is on my laptop, and not others. I've tested this by uploading the files to InfintyFree and making it online just for the sake of testing it on other screens, and what happens is that all the content is scattered around the screen. I've put some pictures to show how it looks in comparison with my laptop, other laptop that I have and my phone. Also I've put the html and css code if you can check it out and see where I screwed up and just point me to the core because I really cannot comprehend what is going on.
Thank in advance, and sorry if there was a question like this before, because I haven't found one.[][]
I have tried putting the *{} and changing properties with it, in the body{}, height, width, overflow, padding, margins, Media only screen, everything. Still, everything fixed but only on my laptop on which it was built.
i made a slidermenu, but i failed some stuff. I dont know how to make it sticky. but the biggest problem is that it looks wheird when i add it to my main file. it works fine when i run the slidebar on a clear page but when i implemnt it into this file it looks crazy. the sysmbols r not infront of the text anymore.
can anyone tell me how i can add the slidermenu to this file right
<!doctype html>
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">
<script src="../js/jquery-3.5.1.min.js"></script>
<link rel="stylesheet" href="../css/stylesearch.css">
<link rel="icon" href="../images/logo.ico">
<link rel="stylesheet" href="../css/slidebar.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<title>Search</title>
</head>
<body>
<div id="background-box" onclick="tag()"></div>
<div class="container" id="tag-box">
<div><a class="close-box" onclick="tag(), getValue()">×</a></div>
<br>Selectable Tags:</br>
</div>
<nav>
<script src="../js/slidebar.js"></script>
<img class="image-size" src="../images/logo.png">
<div class="bars"><i class="fa fa-bars fa-4x" id="scale" onclick="slidebar()"></i></div>
<a><img class="image-size" src="../images/menu.png" onclick=""></a>
<button id="btnabout" onclick="tag()">Tags</button>
<div class="search_box"><input type="text" name="box" id="search_text" placeholder="Search by name" class="form-control" /></div>
<div id="background-boxtitle" onclick="tag()"></div>
</nav>
<section class="sec1">
<div class="slidebar" id="slidebar"><?php include '../db/slidebar.php'; echo $slidebarbutton;?></div>
</section>
<section class="sec2">
<script src="../js/search.js"></script>
<div id="result"></div>
<div style="clear:both"></div>
</section>
<section class="sec3">
</section>
</body>
</html>
:root {
--slidermenu-color: #303030;
}
#slidebar{
position:absolute;
left:-15%;
width: 15%;
height: 100%;
transition: .5s;
background: var(--slidermenu-color);
overflow: scroll;
overflow-x: hidden;
}
#slidebar.active{
left: 0%;
}
#slidebarlock{
position: absolute;
left: -100%;
width: 85%;
height: 100%;
background: transparent;
transition: .5s;
}
#slidebarlock.active{
left: 15%;
}
.slidebarbutton {
background-color: #303030;
border: none;
color: white;
text-align: left;
text-decoration: none;
display: inline-block;
font-size: 30px;
cursor: pointer;
padding: 20px 0px;
width: 100%;
}
.slidebarbutton:hover{
background-color: #494949;
}
.bars:hover{
cursor: pointer;
}
.slidebarbutton div i{
padding-left:20px;
padding-right: 40px;
}
#slidebar::-webkit-scrollbar {
width: 5px;
}
#slidebar::-webkit-scrollbar-track {
background: var(--slidermenu-color);
}
#slidebar::-webkit-scrollbar-thumb {
background: transparent;
}
#slidebar:hover::-webkit-scrollbar-thumb{
background: black;
opacity: .8;
border-radius: 30px;
}
body{
margin: 0;
padding: 0;
font-family: sans-serif;
background: #222;;
}
header{
padding: 10px 100px;
box-sizing: border-box;
}
section{
width: 100%;
height: 100vh;
}
section.sec1{
width: 100%;
height: 50px;
}
div.gallery:hover {
border: 2px solid #404040;
background: #404040;
}
div.gallery {
margin: 5px;
border: 2px solid #222;
float: left;
width: 215px;
height: 400px;
color: #fff;
}
div.gallery img {
width: 100%;
height: 80%;
}
div.desc {
padding: 15px;
text-align: center;
}
section.sec3{
padding: 100px;
box-sizing: border-box;
height: auto;
}
section.sec3 h2{
font-size: 3em;
margin:0;
padding: 0;
color: #fff;
}
nav{
width: 100%;
height: 120px;
background: url(../images/bg1.jpg);
position: sticky;
top: 0px;
}
nav ul{
display: flex;
}
.image-size{
position: absolute;
top: 10%;
right: 1%;
height: 40px;
}
.search_box{
position: absolute;
top: 20%;
left: 50%;
transform: translate(-150%, -50%);
height: 20px;
}
.search_box input[type="text"]{
width: 300%;
padding: 20px;
padding-right: 60px;
box-sizing: border-box;
background: rgba(0,0,0,0.3);
border: 2px solid #fff;
border-radius: 10px;
font-size: 18px;
color: #fff;
outline: none;
}
.fa-search{
position: absolute;
top: 50%;
transform: translateY(-50%);
right: 25px;
color: #fff;
font-size: 25px;
}
::-webkit-input-placeholder {
color: #fff;
}
::-moz-placeholder {
color: #fff;
}
:-ms-input-placeholder {
color: #fff;
}
#media screen and (max-width: 425px){
.search_box{
width: 95%;
}
}
#tag-box{
position: absolute;
top: -120%;
left: 20%;
width: 60%;
height: 500px;
background: #000;
transition: .5s;
opacity: 0.9;
border-radius: 30px;
}
#tag-box.active{
top: 25%;
}
.container{
max-width: 60%;
margin: 0 auto;
display: flex;
flex-wrap: wrap;
}
.container div{
margin: 5px;
}
.container div a{
font-size: 2em;
margin:0;
padding: 0;
color: #fff;
cursor: pointer;
}
.container div a:hover{
color: #f00;
}
.container div label{
cursor: pointer;
}
.container div label input[type="checkbox"]{
display: none;
}
.container div label span{
position: relative;
display: inline-block;
background: #424242;
color: #fff;
padding: 5px 10px;
color: 555;
text-shadow: 0 1px 4px rgba(0,0,0,.5);
border-radius: 15px;
font-size: 12px;
transition: 0.5s;
user-select: none;
overflow: hidden;
border: 2px solid #FFA500;
}
.container div label span:before{
content: '';
position: absolute;
top: absolute;
top: 0;
left: 0;
width: 100%;
height: 50%
}
.container div label input[type="checkbox"]:checked ~ span{
background: #FFA500;
color: #fff;
border: 2px solid #FFA500;
box-shadow: 0 2px 15px #FFA500;
}
#background-box {
position: absolute;
top: -120%;
left: 0%;
width: 100%;
height: 100%;
background: #000;
opacity: 0;
}
#background-box.active{
top: 0%;
}
#background-boxtitle {
position: absolute;
top: -120%;
left: 0%;
width: 100%;
height: 100%;
background: #000;
opacity: 0;
}
#background-boxtitle.active{
top: 0%;
}
#scale{
transition: .5s;
color:white;
transform: translate(22px, 16px);
}
#scale.active{
transition: .5s;
transform: translate(22px, 16px) rotate(90deg);
}
I've created a page with HTML and CSS, the problem is horizontal scrollbar is showing up although as far as I've checked there is no element with width over 100% or inappropriate padding or margin.
here is the complete HTML and CSS code: https://jsfiddle.net/m11nsbag/9/
#keyframes modalAnimation {
from {
top: 90vh;
}
to {
top: 95vh;
background-color: darkcyan;
box-shadow: 5px 5px 25px #747474;
}
}
#headerImage {
width: 100vw;
height: 100vh;
overflow: hidden;
position: fixed;
padding: 0px;
margin: 0px;
z-index: -10000000;
}
#main-nav>li {
width: 9vw;
height: 7vh;
color: #ffffff;
float: right;
text-align: center;
line-height: 7vh;
margin: 0px;
font-size: medium;
z-index: 100;
list-style-type: none;
transition: 0.25s;
}
#main-nav {
background-color: rgba(245, 255, 249, 0.5);
width: 100%;
height: 7vh;
position: fixed;
z-index: 100;
float: right;
transition: all 0.25s;
}
/*
#main-nav:hover {
background-color: rgba(0,129,129,1);
} */
#main-nav>li:hover {
background-color: rgb(232, 255, 92);
}
#wall {
background-color: #d2d2d2;
width: 100%;
height: 100vh;
z-index: -10;
}
* {
margin: 0px;
padding: 0px;
}
#main-nav>li>a {
color: #000;
text-decoration: none;
}
.modalLayout {
opacity: 0;
}
.modalLayout:target {
position: fixed;
background-color: rgba(0, 0, 0, 0.5);
width: 100vw;
height: 100vh;
opacity: 1;
transition: all 0.4s;
z-index: 200;
}
.modal {
text-align: center;
padding: 6% 1% 1.7% 1%;
width: 30vw;
height: 20vh;
margin: 30vh 35vw;
background-color: crimson;
position: fixed;
transition: all 0.4s;
z-index: 10;
border-radius: 10px;
box-shadow: 2px 2px #484848;
}
.closeBtn {
font-size: 35px;
position: absolute;
top: 25vh;
right: 33vw;
float: right;
color: #fff;
font-weight: bold;
text-decoration: none;
z-index: 1000;
cursor: pointer;
margin-right: 5px;
transition: all 0.4s;
}
.mainPageButton>div {
display: none;
}
.mainPageButton:hover>div {
display: block;
transition: all 0.25s;
}
.mainPageButton>div>div {
width: 15vw;
height: 8vh;
background-color: #d2d2d2;
color: #000;
font-size: medium;
float: top;
border-bottom: black 1px solid;
list-style-type: none;
position: relative;
line-height: 8vh;
}
.mainPageButton>div>div>a {
text-decoration: none;
color: #fff;
font-size: medium;
text-align: center;
list-style-type: none;
background-color: #d2d2d2;
padding-right: 2px;
}
.mainMenu {
position: absolute;
top: 88vh;
z-index: 0;
margin-right: 1vw;
}
.mainMenu>div {
width: 15vw;
height: 10vh;
border-bottom: black solid 2px;
margin-bottom: 3vh;
background-color: white;
transition: all .3s;
text-align: center;
line-height: 10vh;
}
.mainMenu>div:hover {
width: 17vw;
height: 12vh;
background-color: #ffcfce;
}
.mainMenu>div>a {
font-size: x-large;
color: #000;
cursor: pointer;
text-decoration: none;
}
.about {
width: 20vw;
height: 40vh;
background-color: #94ffca;
border-radius: 5px;
position: absolute;
top: 88vh;
left: 0;
float: left;
font-size: larger;
padding: 1vw;
transition: all 0.3s;
margin-left: 4px;
overflow: auto;
}
.about:hover {
transform: translate(5px);
background-color: rgba(148, 255, 202, 0.5);
}
#modalcontainer {
background-color: rgba(256, 256, 256, 0.75);
top: 80vh;
position: absolute;
width: 100vw;
height: 200%;
z-index: -10;
border-top-left-radius: 50px;
border-top-right-radius: 50px;
}
#modalswall {
width: 50vw;
height: 150vh;
background-color: #0d213c;
position: absolute;
top: 85vh;
right: 20vw;
z-index: -5;
border-radius: 8px;
box-shadow: 20px 20px 25px grey;
filter: opacity(90%);
}
.bodyModals {
background-color: #acd7ff;
top: 90vh;
width: 35vw;
height: 25vh;
right: 28vw;
position: relative;
z-index: 5;
border-radius: 10px;
transition: all .5s;
margin-bottom: 10vh;
}
.bodyModals:hover {
-webkit-animation: modalAnimation;
-webkit-animation-duration: 3s;
-webkit-animation-direction: alternate;
-webkit-animation-iteration-count: infinite;
}
.bodyModals>p {
padding: 1vw;
font-size: large;
}
#wrapper {
margin-bottom: 170vh;
position: relative;
}
#footer {
position: relative;
width: 100vw;
min-height: 25vh;
bottom: 0;
background-color: #0d213c;
}
#footer>p {
font-size: large;
text-align: center;
color: #fff;
padding: 10px 0px;
}
html,
body {
height: 100%;
margin: 0;
padding: 0;
}
I think there maybe a padding or margin which I'm overlooking but I've been looking at it for several hours and tried almost anything.
thanks for your sincere help.
Update: I changed all the 100vw with 100% and the problem was fixed.
Vertical scrollbars are included in vw units.
So when there's a vertical scrollbar, 100vw is wider than the viewport (without scrollbars).
One suggestion is to change #modalcontainer to width:100% instead of width:100vw.
#keyframes modalAnimation {
from {
top: 90vh;
}
to {
top: 95vh;
background-color: darkcyan;
box-shadow: 5px 5px 25px #747474;
}
}
#headerImage {
width: 100vw;
height: 100vh;
overflow: hidden;
position: fixed;
padding: 0px;
margin: 0px;
z-index: -10000000;
}
#main-nav>li {
width: 9vw;
height: 7vh;
color: #ffffff;
float: right;
text-align: center;
line-height: 7vh;
margin: 0px;
font-size: medium;
z-index: 100;
list-style-type: none;
transition: 0.25s;
}
#main-nav {
background-color: rgba(245, 255, 249, 0.5);
width: 50%;
height: 7vh;
position: fixed;
z-index: 100;
float: right;
transition: all 0.25s;
}
/*
#main-nav:hover {
background-color: rgba(0,129,129,1);
} */
#main-nav>li:hover {
background-color: rgb(232, 255, 92);
}
#wall {
background-color: #d2d2d2;
width: 50%;
height: 100vh;
z-index: -10;
}
* {
margin: 0px;
padding: 0px;
}
#main-nav>li>a {
color: #000;
text-decoration: none;
}
.modalLayout {
opacity: 0;
}
.modalLayout:target {
position: fixed;
background-color: rgba(0, 0, 0, 0.5);
width: 100vw;
height: 100vh;
opacity: 1;
transition: all 0.4s;
z-index: 200;
}
.modal {
text-align: center;
padding: 6% 1% 1.7% 1%;
width: 30vw;
height: 20vh;
margin: 30vh 35vw;
background-color: crimson;
position: fixed;
transition: all 0.4s;
z-index: 10;
border-radius: 10px;
box-shadow: 2px 2px #484848;
}
.closeBtn {
font-size: 35px;
position: absolute;
top: 25vh;
right: 33vw;
float: right;
color: #fff;
font-weight: bold;
text-decoration: none;
z-index: 1000;
cursor: pointer;
margin-right: 5px;
transition: all 0.4s;
}
.mainPageButton>div {
display: none;
}
.mainPageButton:hover>div {
display: block;
transition: all 0.25s;
}
.mainPageButton>div>div {
width: 15vw;
height: 8vh;
background-color: #d2d2d2;
color: #000;
font-size: medium;
float: top;
border-bottom: black 1px solid;
list-style-type: none;
position: relative;
line-height: 8vh;
}
.mainPageButton>div>div>a {
text-decoration: none;
color: #fff;
font-size: medium;
text-align: center;
list-style-type: none;
background-color: #d2d2d2;
padding-right: 2px;
}
.mainMenu {
position: absolute;
top: 88vh;
z-index: 0;
margin-right: 1vw;
}
.mainMenu>div {
width: 15vw;
height: 10vh;
border-bottom: black solid 2px;
margin-bottom: 3vh;
background-color: white;
transition: all .3s;
text-align: center;
line-height: 10vh;
}
.mainMenu>div:hover {
width: 17vw;
height: 12vh;
background-color: #ffcfce;
}
.mainMenu>div>a {
font-size: x-large;
color: #000;
cursor: pointer;
text-decoration: none;
}
.about {
width: 20vw;
height: 40vh;
background-color: #94ffca;
border-radius: 5px;
position: absolute;
top: 88vh;
left: 0;
float: left;
font-size: larger;
padding: 1vw;
transition: all 0.3s;
margin-left: 4px;
overflow: auto;
}
.about:hover {
transform: translate(5px);
background-color: rgba(148, 255, 202, 0.5);
}
#modalcontainer {
background-color: rgba(256, 256, 256, 0.75);
top: 80vh;
position: absolute;
width: 100%;
height: 200%;
z-index: -10;
border-top-left-radius: 50px;
border-top-right-radius: 50px;
}
#modalswall {
width: 50vw;
height: 150vh;
background-color: #0d213c;
position: absolute;
top: 85vh;
right: 20vw;
z-index: -5;
border-radius: 8px;
box-shadow: 20px 20px 25px grey;
filter: opacity(90%);
}
.bodyModals {
background-color: #acd7ff;
top: 90vh;
width: 35vw;
height: 25vh;
right: 28vw;
position: relative;
z-index: 5;
border-radius: 10px;
transition: all .5s;
margin-bottom: 10vh;
}
.bodyModals:hover {
-webkit-animation: modalAnimation;
-webkit-animation-duration: 3s;
-webkit-animation-direction: alternate;
-webkit-animation-iteration-count: infinite;
}
.bodyModals>p {
padding: 1vw;
font-size: large;
}
#wrapper {
margin-bottom: 170vh;
position: relative;
}
#footer {
position: relative;
width: 50vw;
min-height: 25vh;
bottom: 0;
background-color: #0d213c;
}
#footer>p {
font-size: large;
text-align: center;
color: #fff;
padding: 10px 0px;
}
html,
body {
height: 100%;
margin: 0;
padding: 0;
}
<ul id="main-nav">
<li class="mainPageButton">
<div>
<div>
</div>
<div>
</div>
<div>
</div>
<div>
</div>
</div>
</li>
<li>
</li>
<li>
</li>
</ul>
<img src="http://ghmahdi.ir/wp-content/uploads/header.jpg" id="headerImage">
<div id="wrapper">
<div id="aboutMe" class="modalLayout">
<div>
×
</div>
<div class="modal"></div>
</div>
<div id="contactUS" class="modalLayout">
<div>
×
</div>
<div class="modal"></div>
</div>
<div class="mainMenu">
<div> </div>
<div></div>
<div></div>
<div></div>
</div>
<div class="about"></div>
<div id="modalswall"></div>
<div class="bodyModals"> </div>
<div class="bodyModals"></div>
<div class="bodyModals"></div>
<div id="modalcontainer"> </div>
</div>
<div id="footer">
</div>
For interest, also see:
Bug 133271
viewport units in case of 'overflow:auto'
Code I made is not working properly it's working in DW but not in Chrome . In Chrome I have to resize the screen then it change but when I open it in responsive mode it shows zoomed out version.
Here's the code
<!DOCTYPE><html>
<head>
<meta content="width=device-width,initial-scale=1.0">
<title>Shivam | Home</title>
<style type="text/css">
body {
margin: 0;
font-family: cursive;
font-size: 20px;
width: 100%;
height: 5000px;
}
/*menu*/
.nav {
position: fixed;
width: 100%;
max-height: 180px;
z-index: 999;
margin: 0;
padding-left:0;
background: #eee;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.5);
}
.nav li {
float: right;
list-style-type: none;
position: relative;
font-size: 1em;
color: #111;
display: block;
line-height: 3em;
overflow: hidden;
}
.nav li a {
color: #111;
display: block;
padding: 0 26px;
text-decoration: none;
transition: 0.25s all ease;
overflow: hidden;
}
.actv{
background: #08f;
color: #fff;
box-shadow: 0 0 5px rgba(0, 136, 255, 0.5);
transition: 1s ease;
}
.navback{
background: #eee;
position: fixed;
width: 100%;
z-index: 998;
height: 60px;
border-bottom: #08f solid 2px;
}
.logo{
background: #08f;
cursor: default;
}
.sm{
width: 0;
height: 0;
border-left: 30px solid #08f;
border-bottom: 30px solid transparent;
border-top: 30px solid transparent;
padding: 0 0 0 15;
}
/*side bar*/
#btn{
color: #111;
cursor: pointer;
transition:1s;
padding-left:50px;
float:right;
font-size: 25px;
line-height: 60px;
}
.overlay {
height: 100%;
width: 0%;
position: fixed;
z-index: 1000;
top: 0;
left: 0;
background: #08f;
overflow: hidden;
transition: 0.5s;
box-shadow: 2px 0 10px rgba(0,0,0,0.5);
}
.overlay-content {
position: relative;
top: 25%;
width: 100%;
text-align: center;
margin-top: 30px;
}
.overlay a {
padding: 8px;
text-decoration: none;
font-size: 36px;
color: #eee;
display: block;
transition: 0.3s;
}
.overlay-content a:after {
content: '';
display: block;
position: absolute;
left: 50%;
top: 50%;
width: 1000px;
height: 1000px;
margin-left: -500px;
margin-top: -500px;
background: #eee;
border-radius: 100%;
opacity: 1;
transform: scale(0);
}
.overlay .closebtn {
position: absolute;
top: 20px;
right: 45px;
font-size: 60px;
}
.overlay-content a:not(:active):after {
animation: ripple 1s ease-out infinite;
}
.overlay-content a:after {
visibility: hidden;
}
.overlay-content a:focus:after {
visibility: visible;
}
.act{
background: #eee;
}
#media only screen and (max-width: 945px){
.nav{
background: #08f;
}
.nav #a{
display: none;
}
#logo{
margin-left: 10%;
}
#logo a{
padding-right: 0;
}
}
#media only screen and (min-width: 945px){
#btn{
display: none;
}
}
</style>
<script type="text/javascript">
function openNav() {
document.getElementById("myNav").style.width = "65%";
}
function closeNav() {
document.getElementById("myNav").style.width = "0%";
}
</script>
</head>
<body>
<!Submenu>
<ul class="nav">
<li class="logo" style="padding:0;float: left;" title="Open Menu" id="btn" onclick="openNav()"><a><font color="#eee">☰</font></a></li>
<li style="float: left;" id="logo" class="logo"><a title="Shivam"><font color="#eee" size="40px">Shivam</font></a><li id="a" style="float: left;" class="sm"></li></li>
<li id="a"><a> </a></li><li id="a"><a> </a></li><li id="a"><a> </a></li>
<li id="a"><a title="Contact With Shivam" href="contact.html">Contact</a></li>
<li id="a"><a title="About Shivam" href="about.html">About Me</a></li>
<li id="a"><a title=" Shivam's Works" href="works.html">My Works</a></li>
<li id="a"><a title="Homepage"class="actv">Home</a></li>
</ul>
<div id="myNav" class="overlay">
<a title="Close Menu" href="javascript:void(0)" class="closebtn" onclick="closeNav()">×</a>
<div class="overlay-content">
<a title="Home" class="act"><font color="#08f">Home</font></a><hr>
<a title="Works" href="works.html">Works</a><hr>
<a title="About" href="about.html">About</a><hr>
<a title="Contact" href="contact.html">Contact</a>
</div>
</div>
</body>
u forgot the name in the view port link past this in your header
<meta name="viewport" content="width=device-width,initial-scale=1.0">