Footer is not end of page when zooming out - html
since i am learning CSS i am playing around a little, and i ran into this weird issue where the footer is not the end of the page.
Currently my Footer is like this:
If i move the whole div into the footer div, it doesn't show the full content since the footer sticks to the page, so i moved it above to be able to scroll the content, which works fine so far, however, as soon as i zoom out it creates more background below the footer.
html, body {
max-width: 100%;
max-height: 100%;
height: 100%;
overflow-x: visible;
box-sizing: border-box;
font-family: Arial, Helvetica, sans-serif;
margin: 0;
background-color: #666666;
}
/* Style for the navigation */
.topnav {
overflow: hidden;
background-color: #333;
}
/* Style the navigation links */
.topnav a {
float: left;
display: block;
color: #f2f2f2;
text-align: center;
padding: 1.3rem 1.3rem;
text-decoration: none;
font-weight: bold;
}
/* Change color on hover */
.topnav a:hover {
background-color: #ddd;
color: black;
}
.topnav a:not(.active){
padding-bottom: (1.3rem + 6px);
}
.topnav .active:after{
border: 10px solid transparent;
border-bottom-color: #cd650b;
border-top-width: 0;
content: "";
display: block;
z-index: 101;
margin: 0 auto;
width: 0px;
margin-top: 11px;
margin-bottom: -21px;
}
.TopnavSecondBar {
height: 40px;
background-color: #cd650b;
min-width: 100%;
max-width: 100%;
margin: auto;
z-index: 10;
}
/* Triangle Shapes Start*/
.shapes {
position: 50px 50px 50px 50px;
background-color: #cd650b;
}
.boxesFooterBoxesBefore .st0, .boxesFooterBoxesAfter .st0 {
fill: #cd650b;
bottom: 0;
right: 0;
}
*, ::before, ::after {
box-sizing: inherit;
min-width: 0;
}
.boxesFooterBoxes {
color: #eee;
}
/* Content style */
.content {
/* background-color: #d9d9d9; */
padding: 10px;
height: 200px;
}
.button1 {
background-color: #333;
color: white;
padding: 0.5rem;
font-family: Arial, Helvetica, sans-serif;
border-style: hidden;
cursor: pointer;
margin-top: 1rem;
}
.button2 {
text-decoration: none;
background-color: #333;
color: white;
padding: 0.5rem;
font-family: Arial, Helvetica, sans-serif;
border-style: hidden;
cursor: pointer;
margin-top: 1rem;
}
.button2:disabled{
background-color: grey;
color: white;
padding: 0.5rem;
font-family: Arial, Helvetica, sans-serif;
border-style: hidden;
cursor: pointer;
margin-top: 1rem;
}
/* Center Buttons */
.center {
margin: 0;
position: absolute;
top: 50%;
left: 50%;
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
/* Footer */
.footer {
position: fixed;
left: 0;
bottom: 0;
width: 100%;
background-color: transparent;
color: white;
text-align: center;
}
.footerLinks:link, .footerLinks:visited {
background-color: #333;
color: white;
padding: 0.2rem;
text-align: center;
text-decoration: none;
display: inline-block;
margin-top: 0.452125rem;
margin-bottom: 0.1rem;
margin-left: 0.5rem;
margin-right: 0.5rem;
}
.footerLinks:hover, .footerLinks:active {
background-color: #d9d9d9;
color: black;
}
.copyright {
margin-top: 1px;
font-size: .9525rem
}
/* Javascript message style */
.js{
white-space: nowrap;
margin: 0;
position: absolute;
top: 50%;
left: 50%;
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
.converter {
margin: 0;
position: absolute;
top: 50%;
left: 50%;
-ms-transform: translate(-50%, -50%);
transform: translate(-50%, -50%);
}
.boxesFooterBoxesAfter {
width: 101%;
z-index: 1;
height: 60px;
position: relative;
margin-top: 0px;
margin-bottom: 2rem;
}
.BottomNavSecondBar {
height: 40px;
background-color: #cd650b;
min-width: 100%;
max-width: 100%;
margin: 0px auto auto auto;
z-index: 10;
}
.BottomNavThirdBar {
height: 65.2125px;
background-color: #333;
min-width: 100%;
max-width: 100%;
margin: 0px auto auto auto;
z-index: 10;
text-align: center;
}
.AdditionalPartnerBefore, .st2 {
width: 100%;
height: -50px;
position: relative;
margin-bottom: -4px;
}
.codebox {
resize: none;
border-style: solid;
}
/* Display button above text */
/*.btn i {
display: block;
} */
.btn {
width: 8.4rem;
display: inline-block;
background-color: #333;
border: none;
color: white;
padding: 1.7rem;
margin: 0.3rem;
font-size: 17px;
cursor: pointer;
border: solid;
border-color: #cd650b;
border-width: 1px;
}
/* Darker background on mouse-over */
.btn:hover {
background-color: #ddd;
color: black;
border-color: #cd650b;
border-width: 1px;
}
.flex-container {
display: flex;
background-color: transparent;
flex-direction: row;
flex: auto;
}
.flex-container > div {
background-color: transparent;
margin: 20rem;
padding: 20px;
font-size: 30px;
}
.flex-container {
display: flex;
flex-wrap: wrap;
text-align: center;
justify-content: center;
}
.btn {
max-width: 30%;
margin: 5px;
}
.schmutz {
.footer {
display: flex;
background-color: #000;
color: #fff;
height: 170px;
width: 100%;
}
<!DOCTYPE html>
<html lang="en">
<head>
<link rel="icon" type="image/jpg" href="./images/favicon.jpg"> <!--favicon-->
<link rel="stylesheet" href="./styles.css" type="text/css">
<link rel="stylesheet" href="./button.css" type="text/css">
<link rel="stylesheet" href="./math.css" type="text/css">
<script src="https://kit.fontawesome.com/763deb09da.js" crossorigin="anonymous"></script>
<meta charset="UTF-8"> <!--UTF8 charset-->
<meta name="viewport" content="width=device-width,height=device-height,initial-scale=1"> <!--responsive-->
<title>Schmutz</title> <!--page title-->
</head>
<body>
<noscript id="noscript" class="noscript"> <!-- if Javascript is disabled -->
<meta HTTP-EQUIV="refresh" content=0;url="nojs.php">
</noscript> <!-- redirect to nojs site -->
<div class="topnav">
<b>Home</b>
<a class="active" href="./configurator.php"><b>Configurator</b></a>
<b>Trader</b>
<a target="_blank" rel="noopener noreferrer" href="https://scum-forum.com/"><b>Forum</b></a>
</div>
<div class="TopnavSecondBar"></div>
<div class="pageNavigationAfter">
<svg version="1.1" preserveAspectRatio="none" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 1920 80" style="enable-background:new 0 0 1920 80;" xml:space="preserve">
<g transform="translate(0.000000,80.000000) scale(0.100000,-0.100000)">
<path fill="#333" class="st1" d="M0 400 l0 -400 88 1 c48 0 4369 179 9602 398 l9515 399 -9602 1 -9603 1 0 -400z"></path>
</g>
</svg>
</div>
<div class="flex-container">
<button class="btn"><i class="fa fa-wrench"></i> Basics</button>
<button class="btn"><i class="fa fa-car"></i> Vehicle</button>
<button class="btn"><i class="fa fa-dolly"></i> Items</button>
<button class="btn"><i class="fa fa-download"></i> Config</button>
</div>
<hr>
<div class="wrapper">
<div class="a">
<label class="switch">
<input type="checkbox">
<span class="slider"></span>
</label> testtesttesttest
<div class="b">
<label class="test" for="quantity">economy-reset-time-hours</label>
<input class="number" type="number" id="quantity" name="quantity" min="-1" max="100">
<label for="quantity"></label>
</div>
<div class="b">
<label class="test" for="quantity">e</label>
<input class="number" type="number" id="quantity" name="quantity" min="-1" max="100">
<label for="quantity">testtesttesttesttesttest</label>
</div>
<div class="b">
<label class="test" for="quantity">e</label>
<input class="number" type="number" id="quantity" name="quantity" min="-1" max="100">
<label for="quantity">testtesttesttesttesttest</label>
</div>
<div class="b">
<label class="test" for="quantity">e</label>
<input class="number" type="number" id="quantity" name="quantity" min="-1" max="100">
<label for="quantity">testtesttesttesttesttest</label>
</div>
<div class="b">
<label class="test" for="quantity">e</label>
<input class="number" type="number" id="quantity" name="quantity" min="-1" max="100">
<label for="quantity">testtesttesttesttesttest</label>
</div>
<div class="b">
<label class="test" for="quantity">e</label>
<input class="number" type="number" id="quantity" name="quantity" min="-1" max="100">
<label for="quantity">testtesttesttesttesttest</label>
</div>
<div class="b">
<label class="test" for="quantity">e</label>
<input class="number" type="number" id="quantity" name="quantity" min="-1" max="100">
<label for="quantity">testtesttesttesttesttest</label>
</div>
<div class="b">
<label class="test" for="quantity">e</label>
<input class="number" type="number" id="quantity" name="quantity" min="-1" max="100">
<label for="quantity">testtesttesttesttesttest</label>
</div>
<div class="b">
<label class="test" for="quantity">e</label>
<input class="number" type="number" id="quantity" name="quantity" min="-1" max="100">
<label for="quantity">testtesttesttesttesttest</label>
</div>
</div>
</div>
<div class="schmutz">
<div class="AdditionalPartnerBefore">
<svg version="1.1" preserveAspectRatio="none" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" viewBox="0 0 1920 80" style="max-width:100%; enable-background:new 0 0 1920 80;" xml:space="preserve">
<!-- <svg version="1.1" preserveAspectRatio="none" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px" width="100%" height="5rem" style="max-width:100%; enable-background:new 0 0 1920 80;" xml:space="preserve"> -->
<g transform="translate(0.000000,80.000000) scale(0.100000,-0.100000)">
<path fill="#333" class="st2" d="M9480 400 l-9485 -398 9603 -1 9602 -1 0 400 0 400 -117 -1 c-65 -1 -4386 -180 -9603 -399z"></path>
</g>
</svg>
</div>
<div class="BottomNavSecondBar"></div>
<div class="BottomNavThirdBar">
<a class="footerLinks" href="https://scum-forum.com/core/legal-notice/">Legal Notice</a>
<a class="footerLinks" href="https://scum-forum.com/core/privacy-policy/">Privacy Policy</a>
<p class="copyright">© test-test.com<p>
</div>
<div class="footer"></div>
</body>
</html>
You can use flex-box to achieve a footer that stays at the bottom of the browser window when there isn't sufficient content to push it down. When there is sufficient content, the footer will be in a natural flow with the other elements and the page (including footer) will scroll as expected.
You can see how this works in this CodePen. (In the future, creating a minimal reproducible example in something like CodePen can help people debug your issue faster. You'll need to strip away as much as possible from your code so that only the essential parts that cause the issue remain.) I've marked the parts relevant to you, but, in summary:
Set the CSS properties of display: flex; flex-direction: column; min-height: 100vh; on your body (or another element that wraps around your nav, main content, and footer)
Wrap your main content in a wrapping container, like main and apply flex-grow: 1
Related
split homepage into two columns
I'm creating a homepage for my website and want a logo (avatar) to appear on the left hand side of the page and a login form to appear on the right hand side. My current code displays a centered login box and avatar. The avatar is directly above the login box (and slightly offscreen). Ideally I'm looking to replicate facebooks homepage theme (facebook.com) Any ideas? html {% load static %} {#<link rel="stylesheet" type="text/css" href="{% static 'homepage/style.css' %}">#} <html lang=""> <head> <title>Login Form</title> <link rel="stylesheet" type="text/css" href="{% static "homepage/style.css" %}"> <body> <div class="rows"> <div class="logo"> <img src="{% static "homepage/images/my_logo.png" %}" class="avatar" alt="" width="" height=""> </div> <div class="login-box"> <h1>Login</h1> <form> <p>Username</p> <input type="text" name="" placeholder="Enter Username"> <p>Password</p> <input type="password" name="" placeholder="Enter Password"> <input type="submit" name="" value="Login"> Forgot password?<br> Sign-up<br> </form> </div> </div> </body> </html> css body { margin: 0; padding: 0; background-size: cover; background: black center; font-family: sans-serif; } .avatar { float: left; width: 200px; height: 200px; border-radius: 50%; position: absolute; top: -75px; left: calc(50% - 100px); } .login-box{ float: right; width: 320px; height: 420px; background: #000; color: #fff; top: 50%; left: 50%; position: absolute; transform: translate(-50%, -50%); box-sizing: border-box; padding: 70px 30px; } h1 { margin: 0; padding: 0 0 20px; text-align: center; font-size: 22px; } .login-box p { margin: 0; padding: 0; font-weight: bold; } .login-box input { width: 100%; margin-bottom: 20px; } .login-box input[type="text"], input[type="password"] { border: none; border-bottom: 1px solid #fff; background: transparent; outline: none; height: 40px; color: #fff; font-size: 16px; } .login-box input[type="submit"] { border: none; outline: none; height: 40px; background: #ffc107; color: #fff; font-size: 18px; border-radius: 20px; } .login-box input[type="submit"]:hover { cursor: pointer; background: lightgray; color: #000; } .login-box a { text-decoration: none; font-size: 12px; line-height: 20px; color: darkgrey; } .login-box a:hover { color: #ffc107; }
Here is a basic example of placing two items side by side across the screen. The first uses display grid, and outlines 2 columns, the second is using flex. img{ height: 50vh; } .grid-container{ display: grid; height: 50vh; grid-template-columns: auto 1fr; } .flex-container{ display: flex; height: 50vh; } .login { display: flex; flex-direction: column; } <div class="grid-container"> <img src="https://picsum.photos/seed/picsum/200/200" alt=""> <div class="login"> <h1>Login</h1> <form> <div> <label for="email">Email</label> <input type="text" name="email"> </div> <div> <label for="paswd">Password</label> <input type="password" name="passwd"> </div> </form> </div> </div> <div class="flex-container"> <img src="https://picsum.photos/seed/picsum/200/200" alt=""> <div class="login"> <h1>Login</h1> <form> <div> <label for="email">Email</label> <input type="text" name="email"> </div> <div> <label for="paswd">Password</label> <input type="password" name="passwd"> </div> </form> </div> </div>
How to configure div position based on another div bottom position?
I try to put "datacontain" div below "blue-div", but when blue-div height ++, it covers the "datacontain" div, how to make "datacontain" div position responsive to blue-div bottom part position ? Result : -> i want to make the phonenumber (datacontain div) below blue-div //style <style> .responsive { width: 100%; height: auto; } .flex-container { display: flex; flex-direction: column; } .blue-div { max-width: 70%; min-width: 70%; height: 70px; display: table; left: 0; right: 0; margin-left: auto; margin-right: auto; top:-12%; /* /transform: translate(-50%, -50%); */ position: absolute; background-color: #003777; z-index: 130; border-radius: 10px; } .white-cont { width: 80%; height: 215px; display: block; left: 0; right: 0; margin-left: auto; margin-right: auto; margin-top: -25px; /* /transform: translate(-50%, -50%); */ position: absolute; background-color: white; z-index: 100; border-radius: 10px; vertical-align: middle; box-shadow: 1px 1px 6px 1px #888888; } .container-sk { position: relative; } .input-group-addon { color: gray; background-color: #ffffff; } .datacontain { margin-top: 50px; } .submitButton{ border-radius: 35px; display: block; width: 100%; border: none; background-color: #ef7c24; color: white; padding: 14px 28px; font-size: 16px; cursor: pointer; text-align: center; } </style> //html <img src="<?php echo base_url() . 'assets/img/banner.jpg' ?>" alt="Nature" class="responsive"> <div class="container-sk flex-container" style="background-color:#28abe3; min-height:300px"> <div class="white-cont"> <div class="datacontain col-md-12"> <div class=""> <label>phonenumber</label> </div> <div class=""> <div class="form-group"> <div class="input-group"> <div class="input-group-addon"> <img style="height:20px;width:20px" src="<?php echo base_url() . 'assets/img/flag.png' ?>"> +62 </div> <input class="form-control" id="phonenumber" name="phonenumber" type="text" /> </div> </div> <div class="col-md-12 mx-auto"> <button class="submitButton" type="button"> KLAIM VOUCHER </button> </div> </div> </div> <div class="blue-div" style=""> <label style="color:#fff;font-size:14px;display:table-cell;word-wrap: break-word;vertical-align: middle;" >this is voucher 12345 12345 12354 12345 12345 1234 1234 1234 1234 345 345345 345 345 3 </label> </div> </div> </div>
You need to remove position: absolute; on both the blue div and the white container. If you want the blue div to appear first you also need to move it before the white container in your code. .responsive { width: 100%; height: auto; } .flex-container { display: flex; flex-direction: column; } .blue-div { max-width: 70%; min-width: 70%; height: 70px; display: table; left: 0; right: 0; margin-left: auto; margin-right: auto; top:-12%; /* /transform: translate(-50%, -50%); */ background-color: #003777; z-index: 130; border-radius: 10px; } .white-cont { width: 80%; height: 215px; display: block; left: 0; right: 0; margin-left: auto; margin-right: auto; background-color: white; z-index: 100; border-radius: 10px; vertical-align: middle; box-shadow: 1px 1px 6px 1px #888888; } .container-sk { position: relative; } .input-group-addon { color: gray; background-color: #ffffff; } .datacontain { margin-top: 50px; } .submitButton{ border-radius: 35px; display: block; width: 100%; border: none; background-color: #ef7c24; color: white; padding: 14px 28px; font-size: 16px; cursor: pointer; text-align: center; } <div class="container-sk flex-container" style="background-color:#28abe3; min-height:300px"> <div class="blue-div" style=""> <label style="color:#fff;font-size:14px;display:table-cell;word-wrap: break-word;vertical-align: middle;" >this is voucher 12345 12345 12354 12345 12345 1234 1234 1234 1234 345 345345 345 345 3 </label> </div> <div class="white-cont"> <div class="datacontain col-md-12"> <div class=""> <label>phonenumber</label> </div> <div class=""> <div class="form-group"> <div class="input-group"> <div class="input-group-addon"> +62 </div> <input class="form-control" id="phonenumber" name="phonenumber" type="text" /> </div> </div> <div class="col-md-12 mx-auto"> <button class="submitButton" type="button"> KLAIM VOUCHER </button> </div> </div> </div> </div> </div>
How do I hide my navbar on scroll in just css and html [closed]
Closed. This question needs details or clarity. It is not currently accepting answers. Want to improve this question? Add details and clarify the problem by editing this post. Closed 1 year ago. Improve this question I am trying to make my navbar hide when I scroll down without using anything other than html and css with minimal js if possible. I can't provide code until later tonight because of project rules.
I figured out that it is very simple, applied in the code below. <!DOCTYPE html> <html> <head> <!--these are links to the css and little verticle bar icons and also the device width so the navbarand text can work properally at a smaller device width (to an extent)--> <title>Parker Aucoin</title> <link rel="icon" href="favicon.ico" type="image/x-icon"/> <link rel="shortcut icon" href="favicon.ico" type="image/x-icon"/> <meta name="viewport" content="width=device-width,initial-scale=1"> <link rel="stylesheet" type="text/css" href="style.css"> <link rel="stylesheet" type="text/css" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"> </head> <body> <div class="a"> <div id="home"> <div id="navbar"> <script type="text/javascript"> var prevScrollpos = window.pageYOffset; window.onscroll = function() { var currentScrollPos = window.pageYOffset; if (prevScrollpos > currentScrollPos) { document.getElementById("navbar").style.top = "0"; } else { document.getElementById("navbar").style.top = "-100px"; } prevScrollpos = currentScrollPos; } </script> <div id="navlinks"> <ul> <li>Portfolio</li> <li>Contact</li> <li>StackOverflow</li> </ul> </div> </div> <div class="content"> <div class="header"> <p>Parker</p> </div> <div class="header2"> <p><span>Aucoin</span></p> </div> <div class="header3"> <p>Software Developer</p> </div> <div class="gallery-header"> <div id="portfolio"> <h1>Portfolio</h1> <h3>My GitHub <a class="github-btn" href="https://github.com/ParkerAucoin/" target="_blank"> <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-github" viewBox="0 0 16 16"> <path d="M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27.68 0 1.36.09 2 .27 1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.012 8.012 0 0 0 16 8c0-4.42-3.58-8-8-8z"/> </svg> </a> </h3> </div> </div> <p> <div id="gallery"> <a target="_blank" href="images/portfolio1.jpg"> <img src="images/portfolio1.jpg" alt="Forest" width="100" height="200"> </a> <div class="desc"></div> </div> <div id="gallery"> <a target="_blank" href="images/portfolio5.jpg"> <img src="images/portfolio5.jpg" alt="Northern Lights" width="100" height="200"> </a> <div class="desc"></div> </div> <div id="gallery"> <a target="_blank" href="images/portfolio6.jpg"> <img src="images/portfolio6.jpg" alt="Mountains" width="600" height="400"> </a> <div class="desc"></div> </div> </p> <div class="spacer"> <p> <div id="gallery"> <a target="_blank" href="images/portfolio2.jpg"> <img src="images/portfolio2.jpg" alt="Forest" width="100" height="200"> </a> <div class="desc"></div> </div> <div id="gallery"> <a target="_blank" href="images/portfolio3.jpg"> <img src="images/portfolio3.jpg" alt="Northern Lights" width="100" height="200"> </a> <div class="desc"></div> </div> <div id="gallery"> <a target="_blank" href="images/portfolio4.jpg"> <img src="images/portfolio4.jpg" alt="Mountains" width="600" height="400"> </a> <div class="desc"></div> </div> </p> </div> <div id="contact"> <h1 id="contact-header">Contact</h1> <table> <tr> <th> <div id="slideshow"> <div class="slider"> <div class="slides"> <input type="radio" name="radio-btn" id="radio1"> <input type="radio" name="radio-btn" id="radio2"> <input type="radio" name="radio-btn" id="radio3"> <div class="slide first"> <img src="images/portfolio1.jpg" alt="image1"> </div> <div class="slide"> <img src="images/portfolio2.jpg" alt="image1"> </div> <div class="slide"> <img src="images/portfolio3.jpg" alt="image1"> </div> <div class="navigarion-auto"> <div class="auto-btn1"></div> <div class="auto-btn2"></div> <div class="auto-btn3"></div> </div> </div> <div class="navigation-manual"> <label for="radio1" class="manual-btn"></label> <label for="radio2" class="manual-btn"></label> <label for="radio3" class="manual-btn"></label> </div> </div> <script type="text/javascript"> var counter = 1; setInterval(function(){ document.getElementById('radio' + counter).checked = true; counter++; if (counter > 3){ counter = 1; } }, 5000); </script> </th> </tr> </div> </div> </div> </div> </body> </html> CSS: #import url('https://fonts.googleapis.com/css2?family=Fugaz+One&display=swap'); *{ margin: 0; padding: 0; } html { scroll-behavior: smooth; } body{ height: 100vh; background-image: linear-gradient(rgba(0,0,0,0.8),rgba(0,0,0,0.8)),url(images/background.jpg); background-position: center; background-size: cover; overflow-x: hidden; position: relative; margin: 0; padding: 0; display: flex; align-items: center; justify-content: center; font-family: 'Fugaz One', cursive; } #navbar{ transition: .3s; z-index: 1; top: 0; position: sticky; width: 100%; overflow: hidden; display: inline-block; padding-top: 40px; font-family: 'Fugaz One', cursive; } #navlinks{ float: center; display: block; color: #f2f2f2; text-align: center; text-decoration: none; flex: 1; font-family: 'Fugaz One', cursive; } #navlinks ul{ margin-left: 0px; display: inline-block; } #navlinks ul li{ list-style: none; display: inline-block; padding: 8px 25px; } #navlinks ul a{ color: #fff; text-decoration: none; font-size: 15px; } #navlinks ul li::after{ content: ''; width: 0; height: 2px; background: rgb(255, 100, 52); display: block; margin: auto; transition: .3s; } #navlinks ul li:hover::after{ width: 100%; } .header{ font-family: 'Fugaz One', cursive; position: relative; display: block; padding-top: 1500px; color: #fff; text-align: center; margin: 0; } .header p{ font-size: 100px; } .header2{ font-family: 'Fugaz One', cursive; position: relative; display: block; top: -65px; margin: 0; color: #fff; text-align: center; padding-top: -30px; } .header2 p{ font-size: 100px; } .header2 span{ color: rgb(255, 100, 52); } .header3{ font-family: 'Fugaz One', cursive; margin: 0; position: relative; color: rgb(163, 163, 163); font-size: 20px; text-align: center; top: -100px; padding-bottom: 250px; } #contact{ position: relative; color: #fff; text-align: center; float: center; margin: 0; top: 100px; } #slideshow{ top: 20px; align-items: center; justify-content: center; position: relative; margin: 0; padding-bottom: 20px; } .slider{ width: 200px; height: 300; border-radius: 10px; overflow: hidden; } .slides{ width: 500%; height: 400px; display: flex; } .slides input{ display: none; } .slide{ width: 20%; transition: 2s; } .slide img{ width: 200px; height: 500px; } .navigation-manual{ position: absolute; width: 200px; margin-top: -40px; display: flex; justify-content: center; } .manual-btn{ border: 2px solid rgb(255, 100, 52); padding: 5px; border-radius: 10px; cursor: pointer; transition: .3s; } .manual-btn:not(:last-child){ margin-right: 10px; } .manual-btn:hover{ background: rgb(255, 100, 52); } #radio1:checked ~ .first{ margin-left: 0; } #radio2:checked ~ .first{ margin-left: -20%; } #radio3:checked ~ .first{ margin-left: -40%; } .navigation-auto{ position: absolute; display: flex; width: 400px; justify-content: center; margin-top: 460px; } .navigation-auto div{ border: 2px solid rgb(255, 100, 52); padding: 5px; border-radius: 10px; transition: 1s; } .navigation-auto div:not(:last-child){ margin-right: 40px; } #radio1:checked ~ .navigation-auto .auto-btn1{ background: rgb(255, 100, 52); } #radio2:checked ~ .navigation-auto .auto-btn2{ background: rgb(255, 100, 52); } #radio3:checked ~ .navigation-auto .auto-btn3{ background: rgb(255, 100, 52); } .gallery-header{ font-family: 'Fugaz One', cursive; text-align: center; justify-content: center; align-items: center; margin: 0; padding: 20; } #portfolio{ color: #fff; padding-bottom: 50px; } #portfolio h3{ color: rgb(163, 163, 163); } h3 a{ color: rgb(255, 100, 52); } h3 a:hover{ color: rgb(252, 154, 125); } #gallery { margin: 5px; border: 1px solid #ccc; float: left; width: 180px; height: 300px; } #gallery:hover { border: 1px solid #777; } #gallery img { width: 180px; height: 300px; } div.desc { padding: 15px; text-align: center; } th.contact-form{ padding: 16px; position: relative; margin: 0; float: center; }
CSS Styling Issue: classes are styled together, but look vastly different
Trying to figure out why my input fields for my username & password are dramatically different, when they are paired together on my CSS file. Im fairly new and just thinking around, but not sure why there is a size difference. Wonky sizing from password/ username fields. Disregard the horrible image as the logo, just playing around with it all. *{ font-family: "lato", sans-serif; } body{ background-color: #59c9fc; } .login-div{ margin: 100px auto; width: 350px; background-color: #fff padding: 60px; } .logo{ background-color:#59c9fc; width: 150px; height: 150px; border-radius: 50%; margin: 0 auto; margin-bottom: 10px; } .logo img{ width: 100%; } .title, .sub-title{ text-align: center; color: #505050; font-size: 35px; } .sub-title{ font-size: 18px; } .form{ width: 100%; margin-top: 30px; } .form input{ font-size: 18px; padding: 10px 20px 10px 5px; border: none; outline: none; background: none; } .username, .password { display: block; border-radius: 500px; border: 1px solid rgba(0, 0, 0,0.2); padding: 10px; margin: 10px 0; background-color: #fff; } .form svg{ height: 20px; margin-bottom: -5px; margin-left: 10px; margin-right: 5px; } .options{ display: flex; flex-direction: row; justify-content:space-between; padding: 5px 0px; margin-bottom: 30px; } <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <link rel="preconnect" href="https://fonts.gstatic.com"> <link href="https://fonts.googleapis.com/css2?family=Lato:wght#300;400&display=swap" rel="stylesheet"> <link rel="stylesheet" href="main.css" class="css"> <title>Document</title> </head> <body> <div class="login-div"> <div class="logo"> <img src="finger.png" alt=""> </div> <div class="title">Education Community</div> <div class="sub-title">K-12 Education Consultants</div> <div class="form"> <div class="username"> <svg class="svg-icon" viewBox="0 0 20 20"> <path d="M12.075,10.812c1.358-0.853,2.242-2.507,2.242-4.037c0-2.181-1.795-4.618-4.198-4.618S5.921,4.594,5.921,6.775c0,1.53,0.884,3.185,2.242,4.037c-3.222,0.865-5.6,3.807-5.6,7.298c0,0.23,0.189,0.42,0.42,0.42h14.273c0.23,0,0.42-0.189,0.42-0.42C17.676,14.619,15.297,11.677,12.075,10.812 M6.761,6.775c0-2.162,1.773-3.778,3.358-3.778s3.359,1.616,3.359,3.778c0,2.162-1.774,3.778-3.359,3.778S6.761,8.937,6.761,6.775 M3.415,17.69c0.218-3.51,3.142-6.297,6.704-6.297c3.562,0,6.486,2.787,6.705,6.297H3.415z"> </path> </svg> <input type="text" class="text" placeholder="username or email"> </div> <div class="password"> <svg class="svg-icon" viewBox="0 0 20 20"> <path d="M17.308,7.564h-1.993c0-2.929-2.385-5.314-5.314-5.314S4.686,4.635,4.686,7.564H2.693c-0.244,0-0.443,0.2-0.443,0.443v9.3c0,0.243,0.199,0.442,0.443,0.442h14.615c0.243,0,0.442-0.199,0.442-0.442v-9.3C17.75,7.764,17.551,7.564,17.308,7.564 M10,3.136c2.442,0,4.43,1.986,4.43,4.428H5.571C5.571,5.122,7.558,3.136,10,3.136 M16.865,16.864H3.136V8.45h13.729V16.864z M10,10.664c-0.854,0-1.55,0.696-1.55,1.551c0,0.699,0.467,1.292,1.107,1.485v0.95c0,0.243,0.2,0.442,0.443,0.442s0.443-0.199,0.443-0.442V13.7c0.64-0.193,1.106-0.786,1.106-1.485C11.55,11.36,10.854,10.664,10,10.664 M10,12.878c-0.366,0-0.664-0.298-0.664-0.663c0-0.366,0.298-0.665,0.664-0.665c0.365,0,0.664,0.299,0.664,0.665C10.664,12.58,10.365,12.878,10,12.878"> </path> </svg> <input type="text" class="password" placeholder="password"> </div> <div class="options"> <div class="remember-me"> <input id="remember-me" type="checkbox"> <label for="remember-me">Remember me?</label> </div> <div class="forgot-password"> Forgot Password </div> </div> <button class="signin-btn">LOGIN</button> <div class="signup"> New client? Register here. </div> </div> </div> </body> </html>
Remove the password class form the password input. <input type="text" placeholder="password"> * { font-family: "lato", sans-serif; } body { background-color: #59c9fc; } .login-div { margin: 100px auto; width: 350px; background-color: #fff padding: 60px; } .logo { background-color: #59c9fc; width: 150px; height: 150px; border-radius: 50%; margin: 0 auto; margin-bottom: 10px; } .logo img { width: 100%; } .title, .sub-title { text-align: center; color: #505050; font-size: 35px; } .sub-title { font-size: 18px; } .form { width: 100%; margin-top: 30px; } .form input { font-size: 18px; padding: 10px 20px 10px 5px; border: none; outline: none; background: none; } .username, .password { display: block; border-radius: 500px; border: 1px solid rgba(0, 0, 0, 0.2); padding: 10px; margin: 10px 0; background-color: #fff; } .form svg { height: 20px; margin-bottom: -5px; margin-left: 10px; margin-right: 5px; } .options { display: flex; flex-direction: row; justify-content: space-between; padding: 5px 0px; margin-bottom: 30px; } <link rel="preconnect" href="https://fonts.gstatic.com"> <link href="https://fonts.googleapis.com/css2?family=Lato:wght#300;400&display=swap" rel="stylesheet"> <div class="login-div"> <div class="logo"> <img src="finger.png" alt=""> </div> <div class="title">Education Community</div> <div class="sub-title">K-12 Education Consultants</div> <div class="form"> <div class="username"> <svg class="svg-icon" viewBox="0 0 20 20"> <path d="M12.075,10.812c1.358-0.853,2.242-2.507,2.242-4.037c0-2.181-1.795-4.618-4.198-4.618S5.921,4.594,5.921,6.775c0,1.53,0.884,3.185,2.242,4.037c-3.222,0.865-5.6,3.807-5.6,7.298c0,0.23,0.189,0.42,0.42,0.42h14.273c0.23,0,0.42-0.189,0.42-0.42C17.676,14.619,15.297,11.677,12.075,10.812 M6.761,6.775c0-2.162,1.773-3.778,3.358-3.778s3.359,1.616,3.359,3.778c0,2.162-1.774,3.778-3.359,3.778S6.761,8.937,6.761,6.775 M3.415,17.69c0.218-3.51,3.142-6.297,6.704-6.297c3.562,0,6.486,2.787,6.705,6.297H3.415z"> </path> </svg> <input type="text" class="text" placeholder="username or email"> </div> <div class="password"> <svg class="svg-icon" viewBox="0 0 20 20"> <path d="M17.308,7.564h-1.993c0-2.929-2.385-5.314-5.314-5.314S4.686,4.635,4.686,7.564H2.693c-0.244,0-0.443,0.2-0.443,0.443v9.3c0,0.243,0.199,0.442,0.443,0.442h14.615c0.243,0,0.442-0.199,0.442-0.442v-9.3C17.75,7.764,17.551,7.564,17.308,7.564 M10,3.136c2.442,0,4.43,1.986,4.43,4.428H5.571C5.571,5.122,7.558,3.136,10,3.136 M16.865,16.864H3.136V8.45h13.729V16.864z M10,10.664c-0.854,0-1.55,0.696-1.55,1.551c0,0.699,0.467,1.292,1.107,1.485v0.95c0,0.243,0.2,0.442,0.443,0.442s0.443-0.199,0.443-0.442V13.7c0.64-0.193,1.106-0.786,1.106-1.485C11.55,11.36,10.854,10.664,10,10.664 M10,12.878c-0.366,0-0.664-0.298-0.664-0.663c0-0.366,0.298-0.665,0.664-0.665c0.365,0,0.664,0.299,0.664,0.665C10.664,12.58,10.365,12.878,10,12.878"> </path> </svg> <input type="text" placeholder="password"> </div> <div class="options"> <div class="remember-me"> <input id="remember-me" type="checkbox"> <label for="remember-me">Remember me?</label> </div> <div class="forgot-password"> Forgot Password </div> </div> <button class="signin-btn">LOGIN</button> <div class="signup"> New client? Register here. </div> </div> </div> Codepen: https://codepen.io/manaskhandelwal1/pen/OJRKZEy?editors=1100
CSS absolute positioning and resizing windows
First off let me say, I don't do a whole lot of front end design so please excuse all my inline code etc... I've built these check boxes to be able to include the image when clicked. I understand it's not inside the parent class but i'm a bit confused at this point on how to move forward. Since it doesn't have a parent class it just looks for the whole web page as it's parent class i presume. Fairly simple, i think; when i minimize my screen my label positioning removes itself from the boxes and floats off. I'll attach screen shots for more clarity. I've tried to put a few of them in divs with some success but i'm not 100% sure the right way of doing this and that's why i'm here. I've tried some relative positioning as well. <div class="interests"> <div class="subHeader">Interests:</div> <label style="background-color: #000; color:#fff; width:160px; font-family: 'itc_avant_garde_gothic_ltbold'; font-size: 18px !important; text-transform: uppercase; color: #FFF; padding-top: 20px; display: inline-block; z-index: 5; position:absolute; left: 465px; top: 1105px;"><div style="position:relative;left:10px; bottom: 8px;">SKATE</div></label> <label style="background-color: #000; color:#fff; width:160px; font-family: 'itc_avant_garde_gothic_ltbold'; font-size: 18px !important; text-transform: uppercase; color: #FFF; padding-top: 20px; display: inline-block; z-index: 5; position:absolute; left: 685px; top: 1105px;"><div style="position:relative;left:10px; bottom: 8px;">SURF</div></label> <label style="background-color: #000; color:#fff; width:160px; font-family: 'itc_avant_garde_gothic_ltbold'; font-size: 18px !important; text-transform: uppercase; color: #FFF; padding-top: 20px; display: inline-block; z-index: 5; position:absolute; left: 906px; top: 1105px;"><div style="position:relative;left:10px; bottom: 8px;">SNOW</div></label> <label style="background-color: #000; color:#fff; width:160px; font-family: 'itc_avant_garde_gothic_ltbold'; font-size: 18px !important; text-transform: uppercase; color: #FFF; padding-top: 20px; display: inline-block; z-index: 5; position:absolute; left: 465px; top: 1300px;"><div style="position:relative;left:10px; bottom: 8px;"> WOMEN</div></label> <label style="background-color: #000; color:#fff; width:160px; font-family: 'itc_avant_garde_gothic_ltbold'; font-size: 18px !important; text-transform: uppercase; color: #FFF; padding-top: 20px; display: inline-block; z-index: 5; position:absolute; left: 685px; top: 1300px;"><div style="position:relative;left:10px; bottom: 8px;"> MUSIC/ART </div></label> <label style="position: relative; top: 90px;"> <input type="checkbox" name="CheckBox.A address.Sk" style="z-index: 1;position: relative; top:4px;">Skate<img src="https://stuff/Images/thumb.jpg" style="position: absolute;left: 0;bottom: 0;height: 185px;width: 205px;"> </label> <input type="hidden" name="CheckBox.A address.Sk" value="off"> <label style="position: relative; left:140px; top: 90px;"> <input type="checkbox" name="CheckBox.A address.Su" style="z-index: 1;position: relative; top:4px;">Surf<img src="https://stuff/Images/thumb.jpg" style="position: absolute;left: 0;bottom: 0;height: 185px;width: 205px;"> </label> <input type="hidden" name="CheckBox.A address.Su" value="off"> <label style="position: relative; left:290px; top: 90px;"> <input type="checkbox" name="CheckBox.A address.Sn" style="z-index: 1;position: relative; top:4px;">Snow<img src="https://stuff/Images/thumb.jpg" style="position: absolute;left: 0;bottom: 0;height: 185px;width:205px;"> </label> <input type="hidden" name="CheckBox.A address.Sn" value="off"> <br><br><br><br><br><br><br><br><br><br><br><br> <label style="position:relative; top: 60px;"> <input type="checkbox" name="CheckBox.A address.Wo" style="z-index: 1;position: relative; top:4px;">Women<img src="https://stuff/Images/thumb.jpg" style="position: absolute;left: 0;bottom: 0;height: 185px;width:205px;"> </label> <input type="hidden" name="CheckBox.A address.Wo" value="off"> <label style="position:relative; left: 130px; top: 60px;"> <input type="checkbox" name="CheckBox.A address.Mu" style="z-index: 1;position: relative; top:4px;">Music<img src="https://stuff/Images/music_thumb.jpg" style="position: absolute;left: 0;bottom: 0;height: 185px;width:205px;"> </label><input type="hidden" name="CheckBox.A address.Mu " value="off"> <label><input type="checkbox" name="CheckBox.A address.Subscribe"></label> <div style="position:relative; left: 50px; bottom: 33px;">Subscribe</div> <input type="hidden" name="CheckBox.A address.Subscribe" value="off"> <input type="submit" id="submit" value="Sign Up" style="width: 280px; height: 45px; display: block !important; outline-style: none !important; outline-width: 0px !important; color: #fff !important; font-weight: normal !important; font-family: 'itc_avant_garde_gothic_ltbold'; text-transform: uppercase; text-decoration: none; text-align: center; border: 1px solid #434242; background-color: #434242; background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#434242), to(#2f2e2e)); background-image: -webkit-linear-gradient(top, #434242, #2f2e2e); background-image: -moz-linear-gradient(top, #434242, #2f2e2e); background-image: -ms-linear-gradient(top, #434242, #2f2e2e); background-image: -o-linear-gradient(top, #434242, #2f2e2e); -moz-box-shadow: 0 0 1px #bbb; -webkit-box-shadow: 0 0 1px #bbb; box-shadow: 0 0 1px #bbb; -webkit-border-radius: 3px; -moz-border-radius: 3px; border-radius: 3px; vertical-align: middle; padding: 10px 0; line-height: 1em; cursor: pointer; line-height: 18px; font-size: 18px; margin: 40px 0;"> </div> Any help would be greatly appreciated. Thank you. Screen shots below. Labels are floating off when i minimize : Works fine when full screen :
I commented with a few bad practices and falsehoods on another answer, so I really had to make a quick example myself, this is one way to do it with flexbox (there are a lot of solutions to this problem, this is a good one if you don't have to support obsolete browsers): Example: https://jsfiddle.net/um6fm744/1/ CSS: * { box-sizing: border-box; margin: 0; padding: 0; } .interests { display: flex; flex-wrap: wrap; } .sub-header { margin: 0 0 24px; width: 100%; } .interest { align-items: flex-end; background-color: green; display: flex; margin: 0 12px 24px 0; min-height: 160px; width: 160px; } .interest-info { background-color: black; display: flex; justity-content: space-between; width: 100%; } .interest-checkbox { height: 30px; width: 30px; } .interest-label { color: white; font-family: sans-serif; flex: 1; height: 30px; line-height: 30px; margin-left: 12px; } HTML <div class="interests"> <h1 class="sub-header">Interests:</h1> <div class="interest"> <div class="interest-info"> <input class="interest-checkbox" type="checkbox" /> <label class="interest-label">SKATE</label> </div> </div> <div class="interest"> <div class="interest-info"> <input class="interest-checkbox" type="checkbox" /> <label class="interest-label">SNOW</label> </div> </div> <div class="interest"> <div class="interest-info"> <input class="interest-checkbox" type="checkbox" /> <label class="interest-label">WOMEN</label> </div> </div> <div class="interest"> <div class="interest-info"> <input class="interest-checkbox" type="checkbox" /> <label class="interest-label">SURF</label> </div> </div> <div class="interest"> <div class="interest-info"> <input class="interest-checkbox" type="checkbox" /> <label class="interest-label">MUSIC/ART</label> </div> </div> </div>
Please don't use inline styling. I would tackle it more like this: http://codepen.io/anon/pen/VeEXEv HTML: <ul class="items"> <li class="item1"> <button class="add-button">+</button> <span class="description">box 1</span> </li> <li class="item2"> <button class="add-button">+</button> <span class="description">box 2</span> </li> <li class="item3"> <button class="add-button">+</button> <span class="description">box 3</span> </li> <li class="item2"> <button class="add-button">+</button> <span class="description">box 2</span> </li> <li class="item3"> <button class="add-button">+</button> <span class="description">box 3</span> </li> <li class="item1"> <button class="add-button">+</button> <span class="description">box 1</span> </li> </ul> CSS: .items > li { list-style: none; float: left; height: 20px; width: 100px; margin: 10px; border: 1px #000 solid; position: relative; padding-top: 80px; background-size: cover; background-position: center center; background-repeat: no-repeat; } .items .description { background: rgba(0,0,0,0.8); height: 20px; width: 80px; color: #fff; display: block; float: right; text-align: center; } .items .add-button { width: 20px; height: 20px; border: none; background-color: #666; color: #fff; } .item1 { background-image: url(https://pbs.twimg.com/profile_images/586137164188004352/wTK4hjbl.jpg); } .item2 { background-image: url(https://pbs.twimg.com/profile_images/3276050019/f1d244a9f3254f30176922985c761d28.png); } .item3 { background-image: url(https://people.rit.edu/~bmd6715/230/exercises/images/cat.png); }