Why was my scroll bar enabled on my HTML site? - html

I am new in this field and now I am trying to improve myself by testing. I kept trying to figure out why I scroll bar vertically and horizontally, from what I noticed I think it's because of the tables. How can I solve this?
I know I didn't organize it very well, but I really want to solve that scroll bar, I also tried to hide it from the body, but if someone has a lower resolution, the total site will not be displayed. What do you think I could do to them?
body
{
margin: 0;
padding: 0;
min-height: 100vh;
background: #b3ccff;
font-family: arcon;
display: inline-block;
}
/* ------ [profesoreconomist.ro] ------ */
.link{
left: 100px;
top: 50px;
position: absolute;
}
/* ------ [Imagine Banner] ------ */
.banner{
position: relative;
top: 0;
margin-top: 4.3%;
right: -80px;
max-width: 1750px;
}
/* ------ [Continut butoane] ------ */
.spoiler {
display: none;
bottom: 50%;
}
.show {
display: none;
}
.hide:target + .show {
display: inline;
}
.hide:target {
display: none;
}
.hide:target ~ .spoiler {
display: inline;
}
/* ------ [Buton Pagina Principala] ------ */
.btn {
padding: 10px 30px;
margin-bottom: 0;
*margin-left: .3em;
font-size: 16px;
font-weight: bold;
color: #333333;
text-align: center;
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
vertical-align: middle;
cursor: pointer;
background-color: #f5f5f5;
*background-color: #e6e6e6;
border: 1px solid #bbbbbb;
*border: 0;
border-color: #e6e6e6 #e6e6e6 #bfbfbf;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
border-bottom-color: #a2a2a2;
text-decoration: none;
}
.forum-post1 {
position: relative;
padding: 20px;
right: -58px;
}
/* ------ [Buton Curriculum] ------ */
.btn2 {
position: relative;
right: 0;
top: 29%;
padding: 10px 50px;
margin-bottom: 0;
*margin-left: .3em;
font-size: 16px;
font-weight: bold;
color: #333333;
text-align: center;
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
vertical-align: middle;
cursor: pointer;
background-color: #f5f5f5;
*background-color: #e6e6e6;
border: 1px solid #bbbbbb;
*border: 0;
border-color: #e6e6e6 #e6e6e6 #bfbfbf;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
border-bottom-color: #a2a2a2;
text-decoration: none;
}
.forum-post2 {
position: relative;
top: -42px;
left: 270px;
}
/* ------ [Buton Standarde de pregatire...] ------ */
.btn3 {
padding: 10px 12px;
margin-bottom: 0;
*margin-left: .3em;
font-size: 16px;
font-weight: bold;
color: #333333;
text-align: center;
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
vertical-align: middle;
cursor: pointer;
background-color: #f5f5f5;
*background-color: #e6e6e6;
border: 1px solid #bbbbbb;
*border: 0;
border-color: #e6e6e6 #e6e6e6 #bfbfbf;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
border-bottom-color: #a2a2a2;
text-decoration: none;
}
.forum-post3 {
position: relative;
padding: 20px;
right: -435px;
top: -84px;
}
/* ------ [Buton Prolectare didactica] ------ */
.btn4 {
padding: 10px 30px;
margin-bottom: 0;
*margin-left: .3em;
font-size: 16px;
font-weight: bold;
color: #333333;
text-align: center;
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
vertical-align: middle;
cursor: pointer;
background-color: #f5f5f5;
*background-color: #e6e6e6;
border: 1px solid #bbbbbb;
*border: 0;
border-color: #e6e6e6 #e6e6e6 #bfbfbf;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
border-bottom-color: #a2a2a2;
text-decoration: none;
}
.forum-post4 {
position: relative;
padding: 20px;
right: -723px;
top: -146px;
}
/* ------ [Buton Evaluare] ------ */
.btn5 {
padding: 10px 27px;
margin-bottom: 0;
*margin-left: .3em;
font-size: 16px;
font-weight: bold;
color: #333333;
text-align: center;
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
vertical-align: middle;
cursor: pointer;
background-color: #f5f5f5;
*background-color: #e6e6e6;
border: 1px solid #bbbbbb;
*border: 0;
border-color: #e6e6e6 #e6e6e6 #bfbfbf;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
border-bottom-color: #a2a2a2;
text-decoration: none;
}
.forum-post5 {
position: relative;
right: -963px;
top: -188px;
}
/* ------ [Buton Resurse internationale] ------ */
.btn6 {
padding: 10px 12px;
margin-bottom: 0;
*margin-left: .3em;
font-size: 16px;
font-weight: bold;
color: #333333;
text-align: center;
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
vertical-align: middle;
cursor: pointer;
background-color: #f5f5f5;
*background-color: #e6e6e6;
border: 1px solid #bbbbbb;
*border: 0;
border-color: #e6e6e6 #e6e6e6 #bfbfbf;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
border-bottom-color: #a2a2a2;
text-decoration: none;
}
.forum-post6 {
position: relative;
right: -1085px;
top: -210px;
}
/* ------ [Buton Proiecte scolare] ------ */
.btn7 {
padding: 10px 8px;
margin-bottom: 0;
*margin-left: .3em;
font-size: 16px;
font-weight: bold;
color: #333333;
text-align: center;
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
vertical-align: middle;
cursor: pointer;
background-color: #f5f5f5;
*background-color: #e6e6e6;
border: 1px solid #bbbbbb;
*border: 0;
border-color: #e6e6e6 #e6e6e6 #bfbfbf;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
border-bottom-color: #a2a2a2;
text-decoration: none;
}
.forum-post7 {
position: relative;
right: -1273px;
top: -232px;
}
/* ------ [Buton Concursuri si olimpiade scolare] ------ */
.btn8 {
padding: 10px 14px;
margin-bottom: 0;
*margin-left: .3em;
font-size: 16px;
font-weight: bold;
color: #333333;
text-align: center;
text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
vertical-align: middle;
cursor: pointer;
background-color: #f5f5f5;
*background-color: #e6e6e6;
border: 1px solid #bbbbbb;
*border: 0;
border-color: #e6e6e6 #e6e6e6 #bfbfbf;
border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
border-bottom-color: #a2a2a2;
text-decoration: none;
}
.forum-post8 {
position: relative;
right: -1410px;
top: -254px;
}
.spoiler-content {
position: fixed;
bottom: 40%;
right: 45%;
}
/* ------ [Meniu Pagina autentificare] ------ */
input[type=text], input[type=password] {
width: 100%;
padding: 12px 20px;
margin: 8px 0;
display: inline-block;
border: 1px solid #ccc;
box-sizing: border-box;
}
#-webkit-keyframes animatezoom {
from {-webkit-transform: scale(0)}
to {-webkit-transform: scale(1)}
}
#keyframes animatezoom {
from {transform: scale(0)}
to {transform: scale(1)}
}
#media screen and (max-width: 300px) {
span.psw {
display: block;
float: none;
}
/* ------ [Pozitie buton cancel din meniul de autentificare] ------ */
.cancelbtn {
position: fixed;
width: 100%;
bottom: 100%;
}
}
/* ------ [Buton Autentificare] ------ */
.login {
padding: 13px 43px;
margin-bottom: 0;
*margin-left: .3em;
cursor: pointer;
background-color: #4d94ff;
border: none;
width: 200px;
}
/* ------ [Pozitie buton autentificare] ------ */
.plogin {
position: relative;
top: -284px;
right: -1669px;
}
/* ------ [Buton Login din meniul de autentificare] ------ */
.login2 {
padding: 12.5px 43px;
margin-bottom: 0;
*margin-left: .3em;
cursor: pointer;
background-color: #4d94ff;
border: none;
width: 100%;
}
button:hover {
opacity: 0.8;
}
/* ------ [Buton cancel din meniul de autentificare] ------ */
.cancelbtn {
left: 0%;
width: auto;
padding: 10px 18px;
background-color: #f44336;
border: none;
}
/* ------ [Pozitie imagine din meniul de autentificare] ------ */
.imgcontainer {
text-align: center;
margin: 24px 0 12px 0;
position: relative;
}
img.avatar {
width: 20%;
border-radius: 50%;
}
.container {
padding: 16px;
}
span.psw {
float: right;
padding-top: 16px;
}
/* ------ [Background meniu de autentificare] ------ */
.modal {
display: none;
position: fixed;
z-index: 1;
left: 0;
top: 0;
width: 100%;
height: 100%;
overflow: auto;
background-color: rgb(0,0,0);
background-color: rgba(0,0,0,0.4);
padding-top: 60px;
}
/* ------ [Continut meniu login] ------ */
.modal-content {
background-color: #fefefe;
margin: 5% auto 15% auto;
border: 1px solid #888;
width: 80%;
}
/* ------ [Buton X pentru inchidere meniu login] ------ */
.close {
position: absolute;
right: 25px;
top: 0;
color: #000;
font-size: 35px;
font-weight: bold;
}
.close:hover,
.close:focus {
color: red;
cursor: pointer;
}
.animate {
-webkit-animation: animatezoom 0.6s;
animation: animatezoom 0.6s
}
/* ------ [Tabel Noutati] ------ */
.tabel-noutati {
position: relative;
left: 80px;
top: -270px;
border-collapse: collapse;
width: 350px;
background-color: #ffffff;
}
/* ------ [Background alb tabele] ------ */
td, th {
border: 1px solid #dddddd;
text-align: left;
height: 550px;
right: 10px;
}
tr:nth-child(even) {
background-color: #dddddd;
}
/* ------ [Text noutati] ------ */
.news {
position: absolute;
top: -2.5%;
left: 15px;
}
/* ------ [Text link-uri utile] ------ */
.links {
position: absolute;
top: -2.5%;
left: 15px;
}
/* ------ [Tabel link-uri urile] ------ */
.tabel-links{
position: relative;
left: 1399px;
bottom: 0;
border-collapse: collapse;
width: 350px;
background-color: #ffffff;
}
<!DOCTYPE html>
<html>
<head>
<title>xxxxxxx</title>
<link rel="stylesheet" type="text/css" href="style.css">
</head>
<div id="container">
<div id="header">
</div>
<body>
<!------ Buton Pagina Principala ------>
<div class="forum-post1">
Pagina principala
Pagina principala
<div class="spoiler">
<p class="spoiler-content">Bine ai venit pe site-ul nostru!</p>
</div>
</div>
<!------ Buton Curriculum ------>
<div class="forum-post2">
Curriculum
Curriculum
<div class="spoiler">
<p class="spoiler-content">Continutul din Curriculum</p>
</div>
</div>
<!------ Buton Standarde de pregatire profesionala ------>
<div class="forum-post3">
Standarde de pregatire profesionala
Standarde de pregatire profesionala
<div class="spoiler">
<p class="spoiler-content">Standarde de pregatire profesionala</p>
</div>
</div>
<!------ Buton Prolectarea didactică ------>
<div class="forum-post4">
Prolectarea didactică
Prolectarea didactică
<div class="spoiler">
<p class="spoiler-content">Prolectarea didactică</p>
</div>
</div>
<!------ Buton Evaluare ------>
<div class="forum-post5">
Evaluare
Evaluare
<div class="spoiler">
<p class="spoiler-content">Continutul din Evaluare</p>
</div>
</div>
<!------ Buton Resurse internaționale ------>
<div class="forum-post6">
Resurse internaționale
Resurse internaționale
<div class="spoiler">
<p class="spoiler-content">Resurse internaționale</p>
</div>
</div>
<!------ Buton Proiecte școlare ------>
<div class="forum-post7">
Proiecte școlare
Proiecte școlare
<div class="spoiler">
<p class="spoiler-content">Continutul din Proiecte școlare</p>
</div>
</div>
<!------ Buton Concursuri si olimpiade scolare------>
<div class="forum-post8">
Concursuri și olimpiade școlare
Concursuri și olimpiade școlare
<div class="spoiler">
<p class="spoiler-content">Concursuri și olimpiade școlare</p>
</div>
</div>
<!------ Buton catre link-ul profesoreconomit.ro------>
<a class="link" href="www.profesoreconomist.ro">profesoreconomist.ro</a>
<!------ Buton de Autentificare / Meniul de autentificare ------>
<div class="plogin">
<button class="login" onclick="document.getElementById('id01').style.display='block'" style="width:auto;">Autentificare</button>
</div>
<div id="id01" class="modal">
<form class="modal-content animate" action="#" method="post">
<div class="imgcontainer">
<span onclick="document.getElementById('id01').style.display='none'" class="close" title="Close Modal">×</span>
<img src="img\avatar.png" alt="Avatar" class="avatar">
</div>
<div class="container">
<label for="uname"><b>Numele utilizatorului</b></label>
<input type="text" placeholder="Introdu numele de utilizator" name="uname" required>
<label for="psw"><b>Parola</b></label>
<input type="password" placeholder="Introdu parola" name="psw" required>
<button class="login2" type="submit">Login</button>
<label>
<input type="checkbox" checked="checked" name="remember"> Ține-mă minte
</label>
</div>
<div class="container" style="background-color:#f1f1f1">
<button type="button" onclick="document.getElementById('id01').style.display='none'" class="cancelbtn">Cancel</button>
<span class="psw">Ai uitat parola?</span>
</div>
</form>
</div>
<script>
var modal = document.getElementById('id01');
window.onclick = function(event) {
if (event.target == modal) {
modal.style.display = "none";
}
}
</script>
<!------ Tabelurile de noutati si link-uri utile ------>
<table class="tabel-noutati">
<tr>
<th>
<h2 class="news">Noutăți</h2>
<table class="tabel-links">
<tr>
<th class="thh">
<h2 class="links">Link-uri utile</h2>
</body>
</html>

You can implement a vertically stacked overflow menu like this. However, you would need to use JavaScript to "listen" for the menu overflow button on-click event.
Perhaps look into grouping your menu items too, this can also save space. example

If you want to create a horizontal scroll bar, then wrap the contents in a div
Home
News
Contact
About
...
You can also customize it by using
div.scrollmenu {
background-color: #ffff;
overflow: auto;
white-space: nowrap;
}
div.scrollmenu a {
display: inline-block;
color: black;
text-align: center;
padding: 20px;
text-decoration: none;
}
div.scrollmenu a:hover {
background-color: white;
}

Related

Trouble with aligning elements

I came across this issue where I cannot get mine top-box to organize the elements correctly. I've tried everything that I know off and cannot get it to work. I need to have my text 100% in middle and logo just to left but every time I try to do that the text moves to right and its offset. And the Navigation bar to be under the logo and text and that is centered like 100% of time every time I try.
I have a main div as a container, this top-box is a child.
<div class="top-box">
<div class="logo">
<a href="#">
<img src="Assets/Images/WebsiteLogo.png" alt="">
</a>
</div>
<div class="webname">
<a href="#">
<h1>Universal Web Designs</h1>
</a>
</div>
<div class="navigationbar">
<ul>
<li>Home</li>
<li>Designs</li>
<li>About Me</li>
<li>Contact</li>
</ul>
</div>
</div>
Some CSS not all
.top-box {
display: flex;
width: 90%;
padding: 0;
margin: 0.5rem 0 0 0;
border-top-left-radius: 25px;
border-top-right-radius: 25px;
background: rgba(0, 0, 0, 0.75);
border-top: solid white 1px;
border-right: solid white 1px;
border-left: solid white 1px;
}
.logo {
margin: 0;
padding: 0;
border: solid 1px red;
/* background: rgba(255, 255, 255, 1); */
/* border-radius: 5rem; */
}
.logo img {
width: 5rem;
margin: 0;
/* background: rgba(255, 255, 255, 1); */
/* border-radius: 5rem; */
}
.webname {
}
.webname a {
text-decoration: none;
}
.webname h1 {
padding: 0;
margin: 0;
font-size: 3.5rem;
color: rgba(26, 184, 212, 1);
text-shadow: 4px 2px 10px gray;
border: solid 1px red;
}
.webname h1:hover {
color: gray;
text-shadow: 4px 2px 10px rgb(26, 184, 212);
}
.navigationbar {
width: 100%;
text-align: center;
padding: 0;
margin: 0.2rem 0 0 0;
border: solid 1px red;
/* border-top: solid rgba(255, 255, 255, 0.1) 1px; */
}
.navigationbar ul {
list-style-type: none;
}
.navigationbar li{
display: inline;
text-transform: uppercase;
padding: 0;
margin: 0 2rem;
}
.navigationbar a {
text-decoration: none;
font-size: 1.2rem;
color: white;
text-shadow: 2px rgb(26, 184, 212);
}
.navigationbar a:hover {
color: #dc3545;
text-decoration: underline;
}
Thanks
Solution to you question with CSS grid:
.top-box {
width: 90%;
padding: 0;
margin: 0.5rem 0 0 0;
border-top-left-radius: 25px;
border-top-right-radius: 25px;
background: rgba(0, 0, 0, 0.75);
border-top: solid white 1px;
border-right: solid white 1px;
border-left: solid white 1px;
}
.grid {
display: grid;
grid-template-columns: 1fr 555px 1fr;
}
.logo {
margin: 0;
padding: 0;
border: solid 1px red;
/* background: rgba(255, 255, 255, 1); */
/* border-radius: 5rem; */
}
.logo img {
width: 5rem;
margin: 0;
/* background: rgba(255, 255, 255, 1); */
/* border-radius: 5rem; */
}
.webname {
margin: 0 auto;
}
.webname a {
text-decoration: none;
}
.webname h1 {
padding: 0;
margin: 0;
font-size: 3.5rem;
color: rgba(26, 184, 212, 1);
text-shadow: 4px 2px 10px gray;
/* border: solid 1px red; */
}
.webname h1:hover {
color: gray;
text-shadow: 4px 2px 10px rgb(26, 184, 212);
}
.navigationbar {
width: 100%;
text-align: center;
padding: 0;
margin: 0.2rem 0 0 0;
border: solid 1px red;
/* border-top: solid rgba(255, 255, 255, 0.1) 1px; */
}
.navigationbar ul {
list-style-type: none;
}
.navigationbar li{
display: inline;
text-transform: uppercase;
padding: 0;
margin: 0 2rem;
}
.navigationbar a {
text-decoration: none;
font-size: 1.2rem;
color: white;
text-shadow: 2px rgb(26, 184, 212);
}
.navigationbar a:hover {
color: #dc3545;
text-decoration: underline;
}
.logo {
width: 40px;
height:40px;
margin-left: auto;
margin-right: 10px;
align-self: center;
}
<div class="top-box">
<div class="grid">
<div class="logo">
<a href="#">
<img src="Assets/Images/WebsiteLogo.png" alt="">
</a>
</div>
<div class="webname">
<a href="#">
<h1>Universal Web Designs</h1>
</a>
</div>
</div>
<div class="navigationbar">
<ul>
<li>Home</li>
<li>Designs</li>
<li>About Me</li>
<li>Contact</li>
</ul>
</div>
</div>

Placeholder glitches on Chrome and Safari browser showing perfect for mozilla browser

I create login form, have email and password fields both form place changes position in chrome and safari browser
/*LOGIN*/
.login-container{
display: flex;
width: 100%;
min-height: 100vh;
}
.login-form:before{
content: "";
position: absolute;
bottom: 0px;
right: 50px;
height: 800px;
width: 800px;
background: transparent;
border: 1px solid rgba(0, 0, 0, 0.05);
border-radius: 900px;
}
.login-form{
flex-basis: 575px;
flex-grow: 0;
position: relative;
background: linear-gradient(to top left, rgba(50, 78, 225, 0.20) 0%, rgba(255, 255, 255, 0.0) 100%);
background: -moz-linear-gradient(to top left, rgba(50, 78, 225, 0.20) 0%, rgba(255, 255, 255, 0.0) 100%);
background: -webkit-linear-gradient(to top left, rgba(50, 78, 225, 0.20) 0%, rgba(255, 255, 255, 0.0) 100%);
background: -ms-linear-gradient(to top left, rgba(50, 78, 225, 0.20) 0%, rgba(255, 255, 255, 0.0) 100%);
background: -o-linear-gradient(to top left, rgba(50, 78, 225, 0.20) 0%, rgba(255, 255, 255, 0.0) 100%);
padding: 75px;
}
.login-form:after{
content: "";
position: absolute;
bottom: 0px;
right: 130px;
height: 600px;
width: 600px;
background: transparent;
border: 1px solid rgba(0, 0, 0, 0.05);
border-radius: 600px;
}
.login-form .band-identity{
height: 85px;
width: 85px;
border-radius: 20px 35px 20px 35px;
background-color: #000;
display: inline-flex;
align-items: center;
justify-content: center;
border: 5px solid #fff;
}
.login-form .brand-heading{
flex-grow: 1;
flex-basis: 0;
}
.login-form h3.page-title{
font-family: poppins-regular;
font-size: 24px;
background-color: #000000;
border-radius: 100px;
padding: 12px 30px 17px 30px;
color: #fff;
display: inline-flex;
margin-right: -150px;
float: right;
letter-spacing: 1px;
}
.login-container h4.page-title{
font-family: poppins-regular;
font-size: 24px;
background-color: #000000;
border-radius: 100px 0px 0px 100px;
padding: 20px 30px 25px 30px;
color: #fff;
display: inline-flex;
position: absolute;
bottom: 100px;
right: 0px;
}
.login-form h1 span{
font-family: poppins-medium;
font-size: 26px;
color: #000;
display: block;
line-height: 40px;
}
.login-form h1{
font-family: poppins-bold;
color: #324ee1;
font-size: 42px;
position: relative;
padding: 35px 0px 60px 0px;
}
.login-form h1:after{
content: "";
bottom: 0px;
right: 27px;
height: 50px;
width: 50px;
border-radius: 50px;
border: 10px solid #ffc000;
position: absolute;
}
.login-banner{
flex-grow: 1;
flex-basis: 0;
}
.login-banner img{
height: 100%;
width: 100%;
object-fit: cover;
}
form.material-form{
position: relative;
z-index: 1;
}
.material-form .form-group{
margin-bottom: 50px;
}
.material-form label{
color: rgba(0,0,0,0.7);
font-size: 18px;
margin-bottom: 5px;
font-family: avenir-roman;
opacity: 0.5;
}
.material-form a.btn-send-message{
white-space: nowrap;
}
.material-form #errorHandling{
display: none;
}
.material-form .form-group i {
position: absolute;
left: 15px;
top: 45px;
color: rgba(0, 0, 0, 0.60);
font-size: 20px;
}
.material-form .form-group p {
font-family: ubuntu-regular;
font-size: 18px;
opacity: 0.6;
}
.material-form input,
.material-form textarea {
margin: 0px 0px 10px 0px;
width: 100%;
display: block;
border: none;
padding: 10px 0 10px 35px;
border-bottom: solid 1px rgba(0, 0, 0, 0.15);
-webkit-transition: all 0.3s cubic-bezier(0.64, 0.09, 0.08, 1);
transition: all 0.3s cubic-bezier(0.64, 0.09, 0.08, 1);
background: -webkit-linear-gradient(top, rgba(255,255,255,0) 0%, rgba(255,255,255,0) calc(100% - 2px), #324ee1 calc(100% - 2px), #324ee1 100%);
background: linear-gradient(to bottom, rgba(255,255,255,0) 0%, rgba(255,255,255,0) calc(100% - 2px), #324ee1 calc(100% - 2px), #324ee1 100%);
background-position: 0 0;
background-size: 0px 100%;
background-repeat: no-repeat;
color: rgba(0, 0, 0, 0.95);
font-size: 20px;
resize: none;
font-family: poppins-regular;
}
/* .material-form input:focus,
.material-form input:valid,
.material-form textarea:focus,
.material-form textarea:valid { */
.material-form input:focus,
.material-form textarea:focus{
box-shadow: none;
outline: none;
background-size: 100% 100%;
border-bottom: solid 1px #324ee1;
}
.material-form input::-webkit-input-placeholder,
.material-form textarea::-webkit-input-placeholder {
font-family: 'roboto', sans-serif;
-webkit-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
font-size: 10px;
}
.material-form input:focus::-webkit-input-placeholder,
.material-form input:valid::-webkit-input-placeholder,
.material-form textarea:focus::-webkit-input-placeholder,
.material-form textarea:valid::-webkit-input-placeholder {
color: #000;
font-size: 10px;
-webkit-transform: translateY(-20px);
transform: translateY(-20px);
visibility: visible !important;
}
a.link-forgot-password {
font-family: avenir-roman;
font-size: 19px;
color: rgba(0, 0, 0, 0.55);
margin: 10px 0px;
display: block;
}
a.link-forgot-password:hover {
color: rgba(0, 0, 0, 0.75);
}
.btn-login{
margin-top: 35px;
transition: all 0.3s;
font-size: 20px;
}
.btn-login:hover{
color: #fff;
background-color: #3149c9;
margin-top: 32px;
transition: all 0.3s;
}
.btn-login:hover:after{
bottom: -1px;
opacity: 0.85;
}
.btn-login:hover i{
animation: 1s iconbounce forwards;
transition: 0.5s;
}
<form action="login.php" id="login" name="login" method="post" class="material-form py-sm-0">
<div class="row">
<div class="col-12">
<div class="form-group">
<label for="email">email</label>
<i class="far fa-envelope-open"></i>
<input type="text" id="email" name="email" aria-describedby="errorHandling" placeholder="companysupport#gmail.com" >
</div>
</div>
<div class="col-12">
<div class="form-group">
<label for="password">password</label>
<i class="fa fa-key"></i>
<input type="password" id="password" name="password" aria-describedby="errorHandling" placeholder="**********" >
</div>
</div>
<div class="col-12">
Forgot your password?
</div>
<div class="col-12">
<button type="submit" class="btn-style-1 btn-lg btn-login">login <i class="fas fa-arrow-right ml-3"></i></button>
</div>
</div>
</form>
It is showing perfect for mozilla browser
It glitches as below images for chrome and safari browsers as below
Thank You
You should remove the following rules if you don't want to alter its position
.material-form input::-webkit-input-placeholder,
.material-form textarea::-webkit-input-placeholder {
font-family: 'roboto', sans-serif;
-webkit-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
font-size: 10px;
}
.material-form input:focus::-webkit-input-placeholder,
.material-form input:valid::-webkit-input-placeholder,
.material-form textarea:focus::-webkit-input-placeholder,
.material-form textarea:valid::-webkit-input-placeholder {
color: #000;
font-size: 10px;
-webkit-transform: translateY(-20px);
transform: translateY(-20px);
visibility: visible !important;
}
/*LOGIN*/
.login-container {
display: flex;
width: 100%;
min-height: 100vh;
}
.login-form:before {
content: "";
position: absolute;
bottom: 0px;
right: 50px;
height: 800px;
width: 800px;
background: transparent;
border: 1px solid rgba(0, 0, 0, 0.05);
border-radius: 900px;
}
.login-form {
flex-basis: 575px;
flex-grow: 0;
position: relative;
background: linear-gradient(to top left, rgba(50, 78, 225, 0.20) 0%, rgba(255, 255, 255, 0.0) 100%);
background: -moz-linear-gradient(to top left, rgba(50, 78, 225, 0.20) 0%, rgba(255, 255, 255, 0.0) 100%);
background: -webkit-linear-gradient(to top left, rgba(50, 78, 225, 0.20) 0%, rgba(255, 255, 255, 0.0) 100%);
background: -ms-linear-gradient(to top left, rgba(50, 78, 225, 0.20) 0%, rgba(255, 255, 255, 0.0) 100%);
background: -o-linear-gradient(to top left, rgba(50, 78, 225, 0.20) 0%, rgba(255, 255, 255, 0.0) 100%);
padding: 75px;
}
.login-form:after {
content: "";
position: absolute;
bottom: 0px;
right: 130px;
height: 600px;
width: 600px;
background: transparent;
border: 1px solid rgba(0, 0, 0, 0.05);
border-radius: 600px;
}
.login-form .band-identity {
height: 85px;
width: 85px;
border-radius: 20px 35px 20px 35px;
background-color: #000;
display: inline-flex;
align-items: center;
justify-content: center;
border: 5px solid #fff;
}
.login-form .brand-heading {
flex-grow: 1;
flex-basis: 0;
}
.login-form h3.page-title {
font-family: poppins-regular;
font-size: 24px;
background-color: #000000;
border-radius: 100px;
padding: 12px 30px 17px 30px;
color: #fff;
display: inline-flex;
margin-right: -150px;
float: right;
letter-spacing: 1px;
}
.login-container h4.page-title {
font-family: poppins-regular;
font-size: 24px;
background-color: #000000;
border-radius: 100px 0px 0px 100px;
padding: 20px 30px 25px 30px;
color: #fff;
display: inline-flex;
position: absolute;
bottom: 100px;
right: 0px;
}
.login-form h1 span {
font-family: poppins-medium;
font-size: 26px;
color: #000;
display: block;
line-height: 40px;
}
.login-form h1 {
font-family: poppins-bold;
color: #324ee1;
font-size: 42px;
position: relative;
padding: 35px 0px 60px 0px;
}
.login-form h1:after {
content: "";
bottom: 0px;
right: 27px;
height: 50px;
width: 50px;
border-radius: 50px;
border: 10px solid #ffc000;
position: absolute;
}
.login-banner {
flex-grow: 1;
flex-basis: 0;
}
.login-banner img {
height: 100%;
width: 100%;
object-fit: cover;
}
form.material-form {
position: relative;
z-index: 1;
}
.material-form .form-group {
margin-bottom: 50px;
}
.material-form label {
color: rgba(0, 0, 0, 0.7);
font-size: 18px;
margin-bottom: 5px;
font-family: avenir-roman;
opacity: 0.5;
}
.material-form a.btn-send-message {
white-space: nowrap;
}
.material-form #errorHandling {
display: none;
}
.material-form .form-group i {
position: absolute;
left: 15px;
top: 45px;
color: rgba(0, 0, 0, 0.60);
font-size: 20px;
}
.material-form .form-group p {
font-family: ubuntu-regular;
font-size: 18px;
opacity: 0.6;
}
.material-form input,
.material-form textarea {
margin: 0px 0px 10px 0px;
width: 100%;
display: block;
border: none;
padding: 10px 0 10px 35px;
border-bottom: solid 1px rgba(0, 0, 0, 0.15);
-webkit-transition: all 0.3s cubic-bezier(0.64, 0.09, 0.08, 1);
transition: all 0.3s cubic-bezier(0.64, 0.09, 0.08, 1);
background: -webkit-linear-gradient(top, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0) calc(100% - 2px), #324ee1 calc(100% - 2px), #324ee1 100%);
background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0) calc(100% - 2px), #324ee1 calc(100% - 2px), #324ee1 100%);
background-position: 0 0;
background-size: 0px 100%;
background-repeat: no-repeat;
color: rgba(0, 0, 0, 0.95);
font-size: 20px;
resize: none;
font-family: poppins-regular;
}
/* .material-form input:focus,
.material-form input:valid,
.material-form textarea:focus,
.material-form textarea:valid { */
.material-form input:focus,
.material-form textarea:focus {
box-shadow: none;
outline: none;
background-size: 100% 100%;
border-bottom: solid 1px #324ee1;
}
a.link-forgot-password {
font-family: avenir-roman;
font-size: 19px;
color: rgba(0, 0, 0, 0.55);
margin: 10px 0px;
display: block;
}
a.link-forgot-password:hover {
color: rgba(0, 0, 0, 0.75);
}
.btn-login {
margin-top: 35px;
transition: all 0.3s;
font-size: 20px;
}
.btn-login:hover {
color: #fff;
background-color: #3149c9;
margin-top: 32px;
transition: all 0.3s;
}
.btn-login:hover:after {
bottom: -1px;
opacity: 0.85;
}
.btn-login:hover i {
animation: 1s iconbounce forwards;
transition: 0.5s;
}
<form action="login.php" id="login" name="login" method="post" class="material-form py-sm-0">
<div class="row">
<div class="col-12">
<div class="form-group">
<label for="email">email</label>
<i class="far fa-envelope-open"></i>
<input type="text" id="email" name="email" aria-describedby="errorHandling" placeholder="companysupport#gmail.com">
</div>
</div>
<div class="col-12">
<div class="form-group">
<label for="password">password</label>
<i class="fa fa-key"></i>
<input type="password" id="password" name="password" aria-describedby="errorHandling" placeholder="**********">
</div>
</div>
<div class="col-12">
Forgot your password?
</div>
<div class="col-12">
<button type="submit" class="btn-style-1 btn-lg btn-login">login <i class="fas fa-arrow-right ml-3"></i></button>
</div>
</div>
</form>
You should use the following code to support all browsers:
Example:
.input-email::-webkit-input-placeholder {
font-style: italic;
font-size: 12px;
font-weight: 600;
color: #9b9b9b;
}
/* WebKit, Blink, Edge */
.input-email:-moz-placeholder {
font-style: italic;
font-size: 12px;
font-weight: 600;
color: #9b9b9b;
}
/* Mozilla Firefox 4 to 18 */
.input-email::-moz-placeholder {
font-style: italic;
font-size: 12px;
font-weight: 600;
color: #9b9b9b;
}
/* Mozilla Firefox 19+ */
.input-email:-ms-input-placeholder {
font-style: italic;
font-size: 12px;
font-weight: 600;
color: #9b9b9b;
}
/* Internet Explorer 10-11 */
.input-email::-ms-input-placeholder {
font-style: italic;
font-size: 12px;
font-weight: 600;
color: #9b9b9b;
}
Remove this code
-webkit-transform: translateY(-20px);
transform: translateY(-20px);
from
.material-form input:focus::-webkit-input-placeholder,
.material-form input:valid::-webkit-input-placeholder,
.material-form textarea:focus::-webkit-input-placeholder,
.material-form textarea:valid::-webkit-input-placeholder {
color: #000;
font-size: 10px;
-webkit-transform: translateY(-20px);
transform: translateY(-20px);
visibility: visible !important;
}
/*LOGIN*/
.login-container{
display: flex;
width: 100%;
min-height: 100vh;
}
.login-form:before{
content: "";
position: absolute;
bottom: 0px;
right: 50px;
height: 800px;
width: 800px;
background: transparent;
border: 1px solid rgba(0, 0, 0, 0.05);
border-radius: 900px;
}
.login-form{
flex-basis: 575px;
flex-grow: 0;
position: relative;
background: linear-gradient(to top left, rgba(50, 78, 225, 0.20) 0%, rgba(255, 255, 255, 0.0) 100%);
background: -moz-linear-gradient(to top left, rgba(50, 78, 225, 0.20) 0%, rgba(255, 255, 255, 0.0) 100%);
background: -webkit-linear-gradient(to top left, rgba(50, 78, 225, 0.20) 0%, rgba(255, 255, 255, 0.0) 100%);
background: -ms-linear-gradient(to top left, rgba(50, 78, 225, 0.20) 0%, rgba(255, 255, 255, 0.0) 100%);
background: -o-linear-gradient(to top left, rgba(50, 78, 225, 0.20) 0%, rgba(255, 255, 255, 0.0) 100%);
padding: 75px;
}
.login-form:after{
content: "";
position: absolute;
bottom: 0px;
right: 130px;
height: 600px;
width: 600px;
background: transparent;
border: 1px solid rgba(0, 0, 0, 0.05);
border-radius: 600px;
}
.login-form .band-identity{
height: 85px;
width: 85px;
border-radius: 20px 35px 20px 35px;
background-color: #000;
display: inline-flex;
align-items: center;
justify-content: center;
border: 5px solid #fff;
}
.login-form .brand-heading{
flex-grow: 1;
flex-basis: 0;
}
.login-form h3.page-title{
font-family: poppins-regular;
font-size: 24px;
background-color: #000000;
border-radius: 100px;
padding: 12px 30px 17px 30px;
color: #fff;
display: inline-flex;
margin-right: -150px;
float: right;
letter-spacing: 1px;
}
.login-container h4.page-title{
font-family: poppins-regular;
font-size: 24px;
background-color: #000000;
border-radius: 100px 0px 0px 100px;
padding: 20px 30px 25px 30px;
color: #fff;
display: inline-flex;
position: absolute;
bottom: 100px;
right: 0px;
}
.login-form h1 span{
font-family: poppins-medium;
font-size: 26px;
color: #000;
display: block;
line-height: 40px;
}
.login-form h1{
font-family: poppins-bold;
color: #324ee1;
font-size: 42px;
position: relative;
padding: 35px 0px 60px 0px;
}
.login-form h1:after{
content: "";
bottom: 0px;
right: 27px;
height: 50px;
width: 50px;
border-radius: 50px;
border: 10px solid #ffc000;
position: absolute;
}
.login-banner{
flex-grow: 1;
flex-basis: 0;
}
.login-banner img{
height: 100%;
width: 100%;
object-fit: cover;
}
form.material-form{
position: relative;
z-index: 1;
}
.material-form .form-group{
margin-bottom: 50px;
}
.material-form label{
color: rgba(0,0,0,0.7);
font-size: 18px;
margin-bottom: 5px;
font-family: avenir-roman;
opacity: 0.5;
}
.material-form a.btn-send-message{
white-space: nowrap;
}
.material-form #errorHandling{
display: none;
}
.material-form .form-group i {
position: absolute;
left: 15px;
top: 45px;
color: rgba(0, 0, 0, 0.60);
font-size: 20px;
}
.material-form .form-group p {
font-family: ubuntu-regular;
font-size: 18px;
opacity: 0.6;
}
.material-form input,
.material-form textarea {
margin: 0px 0px 10px 0px;
width: 100%;
display: block;
border: none;
padding: 10px 0 10px 35px;
border-bottom: solid 1px rgba(0, 0, 0, 0.15);
-webkit-transition: all 0.3s cubic-bezier(0.64, 0.09, 0.08, 1);
transition: all 0.3s cubic-bezier(0.64, 0.09, 0.08, 1);
background: -webkit-linear-gradient(top, rgba(255,255,255,0) 0%, rgba(255,255,255,0) calc(100% - 2px), #324ee1 calc(100% - 2px), #324ee1 100%);
background: linear-gradient(to bottom, rgba(255,255,255,0) 0%, rgba(255,255,255,0) calc(100% - 2px), #324ee1 calc(100% - 2px), #324ee1 100%);
background-position: 0 0;
background-size: 0px 100%;
background-repeat: no-repeat;
color: rgba(0, 0, 0, 0.95);
font-size: 20px;
resize: none;
font-family: poppins-regular;
}
/* .material-form input:focus,
.material-form input:valid,
.material-form textarea:focus,
.material-form textarea:valid { */
.material-form input:focus,
.material-form textarea:focus{
box-shadow: none;
outline: none;
background-size: 100% 100%;
border-bottom: solid 1px #324ee1;
}
.material-form input::-webkit-input-placeholder,
.material-form textarea::-webkit-input-placeholder {
font-family: 'roboto', sans-serif;
-webkit-transition: all 0.3s ease-in-out;
transition: all 0.3s ease-in-out;
font-size: 10px;
}
.material-form input:focus::-webkit-input-placeholder,
.material-form input:valid::-webkit-input-placeholder,
.material-form textarea:focus::-webkit-input-placeholder,
.material-form textarea:valid::-webkit-input-placeholder {
color: #000;
font-size: 10px;
visibility: visible !important;
}
a.link-forgot-password {
font-family: avenir-roman;
font-size: 19px;
color: rgba(0, 0, 0, 0.55);
margin: 10px 0px;
display: block;
}
a.link-forgot-password:hover {
color: rgba(0, 0, 0, 0.75);
}
.btn-login{
margin-top: 35px;
transition: all 0.3s;
font-size: 20px;
}
.btn-login:hover{
color: #fff;
background-color: #3149c9;
margin-top: 32px;
transition: all 0.3s;
}
.btn-login:hover:after{
bottom: -1px;
opacity: 0.85;
}
.btn-login:hover i{
animation: 1s iconbounce forwards;
transition: 0.5s;
}
<form action="login.php" id="login" name="login" method="post" class="material-form py-sm-0">
<div class="row">
<div class="col-12">
<div class="form-group">
<label for="email">email</label>
<i class="far fa-envelope-open"></i>
<input type="text" id="email" name="email" aria-describedby="errorHandling" placeholder="companysupport#gmail.com" >
</div>
</div>
<div class="col-12">
<div class="form-group">
<label for="password">password</label>
<i class="fa fa-key"></i>
<input type="password" id="password" name="password" aria-describedby="errorHandling" placeholder="**********" >
</div>
</div>
<div class="col-12">
Forgot your password?
</div>
<div class="col-12">
<button type="submit" class="btn-style-1 btn-lg btn-login">login <i class="fas fa-arrow-right ml-3"></i></button>
</div>
</div>
</form>

Fit content inside the border

Just wrote some newbie css kind of code. I don't know how to fit the image inside the border! I want to fit the water icon inside the circular border! Please run the snippet below
.notice {
position: relative;
margin: 1em;
background: #f3fff2;
padding: 1em 1em 1em 2em;
border-left: 4px solid #DDD;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.125);
}
.notice:before {
position: absolute;
top: 50%;
margin-top: -17px;
left: -17px;
background-color: #DDD;
color: #FFF;
width: 40px;
height: 40px;
border-radius: 100%;
text-align: center;
line-height: 30px;
font-weight: bold;
font-family: Georgia;
text-shadow: 1px 1px rgba(0, 0, 0, 0.5);
}
.info {
border-color: #e4ffe0;
}
.info:before {
content: url('http://www.free-icons-download.net/images/water-droplet-icon-72075.png');
background-color: #e4ffe0;
}
<div class="notice info">
<p>This is a an info notice, it provides feedback of a neutral nature to the user.</p>
</div>
Use content image as a background...it will be easy for you to control the size of image
Stack Snippet
.notice {
position: relative;
margin: 1em;
background: #f3fff2;
padding: 1em 1em 1em 2em;
border-left: 4px solid #DDD;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.125);
}
.notice:before {
position: absolute;
top: 50%;
margin-top: -17px;
left: -17px;
background-color: #DDD;
color: #FFF;
width: 40px;
height: 40px;
border-radius: 100%;
text-align: center;
line-height: 30px;
font-weight: bold;
font-family: Georgia;
text-shadow: 1px 1px rgba(0, 0, 0, 0.5);
}
.info {
border-color: #e4ffe0;
}
.info:before {
content: "";
background: #e4ffe0 url('http://www.free-icons-download.net/images/water-droplet-icon-72075.png') center/20px no-repeat
}
<div class="notice info">
<p>This is a an info notice, it provides feedback of a neutral nature to the user.</p>
</div>
Why not put it in as a background?
.notice {
position: relative;
margin: 1em;
background: #f3fff2;
padding: 1em 1em 1em 2em;
border-left: 4px solid #DDD;
box-shadow: 0 1px 1px rgba(0, 0, 0, 0.125);
}
.notice:before {
position: absolute;
top: 50%;
margin-top: -17px;
left: -17px;
background-color: #DDD;
color: #FFF;
width: 40px;
height: 40px;
border-radius: 100%;
text-align: center;
line-height: 30px;
font-weight: bold;
font-family: Georgia;
text-shadow: 1px 1px rgba(0, 0, 0, 0.5);
}
.info {
border-color: #e4ffe0;
}
.info:before {
content: '';
display: inline-block;
background: #e4ffe0 url('http://www.free-icons-download.net/images/water-droplet-icon-72075.png') no-repeat center/contain;
}
<div class="notice info">
<p>This is a an info notice, it provides feedback of a neutral nature to the user.</p>
</div>

Styling a button with hover effect

I'm having some issues with my code.
I added this button to my HTML page and CSS with the styling of the button class and the hover effect:
.buton4e {
background-color: #383f95;
border: none;
border-radius: 8px;
color: white;
padding: 7px 16px;
text-align: center;
text-decoration: none;
display: inline-block;
font-weight: bold;
cursor: pointer;
font-size: 16px;
}
.buton4e:hover {
background-color: #383f95;
border: none;
border-radius: 8px;
color: white;
padding: 7px 16px;
text-align: center;
text-decoration: none;
display: inline-block;
font-weight: bold;
font-size: 16px;
box-shadow: 0 12px 16px 0 rgba(0, 0, 0, 0.24), 0 17px 40px 0 rgba(0, 0, 0, 0.19);
}
.intro-header {
padding-top: 40px;
padding-bottom: 40px;
text-align: center;
color: #f8f8f8;
background: url(../img/background.jpg) no-repeat center center;
background-size: cover;
}
.intro-message {
position: relative;
padding-top: 20%;
padding-bottom: 20%;
}
.intro-message>h1 {
margin: 0;
text-shadow: 2px 2px 3px rgba(0, 0, 0, 0.6);
font-size: 5em;
}
.intro-divider {
width: 400px;
border-top: 1px solid #f8f8f8;
border-bottom: 1px solid rgba(0, 0, 0, 0.2);
}
.intro-message>h3 {
text-shadow: 2px 2px 3px rgba(0, 0, 0, 0.6);
}
<!-- Header -->
<header class="intro-header">
<div class="container">
<div class="intro-message">
<br /><br /><br />
<h3>90% of IT companies believe they need to partner to grow.<br /> Join <b>Channeliser</b> - the global network for building IT partnerships.</h3>
<hr class="intro-divider">
<button class="buton4e">JOIN FOR FREE</button>
</div>
</div>
</header>
The problem is that the effect works when I hover the button but there when the button is static it has no styling
*EDIT:
Sorry for not posting all the code.
This should be sufficient for the things I'm trying to modify.
Thanks in advance.
.styledButton {
font-family: Arial;
width: 100px;
height: 50px;
color: black;
background-color: grey;
border: 0;
-webkit-transition-duration: 0.3s;
transition-duration: 0.3s;
}
.styledButton:hover {
color: white;
background-color: black;
}
.styledButton:active {
opacity: 0.5;
}
<button class = "styledButton">Click Me!</button>
This should help. Any click animations I have trouble with.

Vertical centering with flexbox [duplicate]

This question already has an answer here:
Vertically align a flexbox
(1 answer)
Closed 5 years ago.
I'm currently having issues vertically centering the wrapper. I attempted to create a div that displays flex and aligns items center as suggested by another post and it didn't work. Any ideas why and how to resolve it?
body {
font-family: Arial, sans-serif;
background: #ddd;
}
h1 {
text-align: center;
font-family: "Trebuchet MS", Tahoma, Arial, sans-serif;
color: #333;
text-shadow: 0 1px 0 #fff;
margin: 50px 0;
}
#center {
display: flex;
align-items: center;
}
#wrapper {
width: 100px;
margin: 0 auto;
background: #fff;
padding: 20px;
border: 10px solid #aaa;
border-radius: 15px;
background-clip: padding-box;
text-align: center;
}
.button {
font-family: Helvetica, Arial, sans-serif;
font-size: 13px;
padding: 5px 10px;
border: 1px solid #aaa;
background-color: #eee;
background-image: linear-gradient(top, #fff, #f0f0f0);
border-radius: 2px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
color: #666;
text-decoration: none;
text-shadow: 0 1px 0 #fff;
cursor: pointer;
transition: all 0.2s ease-out;
}
.button:hover {
border-color: #999;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
.button:active {
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25) inset;
}
.overlay {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.5);
transition: opacity 200ms;
visibility: hidden;
opacity: 0;
}
.overlay.light {
background: rgba(255, 255, 255, 0.5);
}
.overlay .cancel {
position: absolute;
width: 100%;
height: 100%;
cursor: default;
}
.overlay:target {
visibility: visible;
opacity: 1;
}
.popup {
margin: 75px auto;
padding: 20px;
background: #fff;
border: 1px solid #666;
width: 300px;
box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
position: relative;
}
.light .popup {
border-color: #aaa;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}
.popup h2 {
margin-top: 0;
color: #666;
font-family: "Trebuchet MS", Tahoma, Arial, sans-serif;
}
.popup .close {
position: absolute;
width: 20px;
height: 20px;
top: 20px;
right: 20px;
opacity: 0.8;
transition: all 200ms;
font-size: 24px;
font-weight: bold;
text-decoration: none;
color: #666;
}
.popup .close:hover {
opacity: 1;
}
.popup .content {
max-height: 400px;
overflow: auto;
}
.popup p {
margin: 0 0 1em;
}
.popup p:last-child {
margin: 0;
}
iframe {
border: none;
}
<div id="center">
<div id="wrapper">
<p><a class="button" href="#popup1">Click Me</a></p>
</div>
<div id="popup1" class="overlay">
<div class="popup">
<h2>Drop Day</h2>
<a class="close" href="#">×</a>
<div class="content">
<p>Hello</p>
</div>
</div>
</div>
</div>
Your main wrapper (div#center) must have its height defined:
body {
font-family: Arial, sans-serif;
background: #ddd;
}
h1 {
text-align: center;
font-family: "Trebuchet MS", Tahoma, Arial, sans-serif;
color: #333;
text-shadow: 0 1px 0 #fff;
margin: 50px 0;
}
#center {
display: flex;
align-items: center;
/* or any other height you want */
height: 100vh;
}
#wrapper {
width: 100px;
margin: 0 auto;
background: #fff;
padding: 20px;
border: 10px solid #aaa;
border-radius: 15px;
background-clip: padding-box;
text-align: center;
}
.button {
font-family: Helvetica, Arial, sans-serif;
font-size: 13px;
padding: 5px 10px;
border: 1px solid #aaa;
background-color: #eee;
background-image: linear-gradient(top, #fff, #f0f0f0);
border-radius: 2px;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
color: #666;
text-decoration: none;
text-shadow: 0 1px 0 #fff;
cursor: pointer;
transition: all 0.2s ease-out;
}
.button:hover {
border-color: #999;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25);
}
.button:active {
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.25) inset;
}
.overlay {
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.5);
transition: opacity 200ms;
visibility: hidden;
opacity: 0;
}
.overlay.light {
background: rgba(255, 255, 255, 0.5);
}
.overlay .cancel {
position: absolute;
width: 100%;
height: 100%;
cursor: default;
}
.overlay:target {
visibility: visible;
opacity: 1;
}
.popup {
margin: 75px auto;
padding: 20px;
background: #fff;
border: 1px solid #666;
width: 300px;
box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
position: relative;
}
.light .popup {
border-color: #aaa;
box-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
}
.popup h2 {
margin-top: 0;
color: #666;
font-family: "Trebuchet MS", Tahoma, Arial, sans-serif;
}
.popup .close {
position: absolute;
width: 20px;
height: 20px;
top: 20px;
right: 20px;
opacity: 0.8;
transition: all 200ms;
font-size: 24px;
font-weight: bold;
text-decoration: none;
color: #666;
}
.popup .close:hover {
opacity: 1;
}
.popup .content {
max-height: 400px;
overflow: auto;
}
.popup p {
margin: 0 0 1em;
}
.popup p:last-child {
margin: 0;
}
iframe {
border: none;
}
<html>
<head>
<meta charset="UTF-8">
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' name='viewport'>
</head>
<body>
<div id="center">
<div id="wrapper">
<p><a class="button" href="#popup1">Click Me</a></p>
</div>
<div id="popup1" class="overlay">
<div class="popup">
<h2>Drop Day</h2>
<a class="close" href="#">×</a>
<div class="content">
<p>Hello</p>
</div>
</div>
</div>
</div>
</body>
</html>