Content is hidden mobile device - html

I am building a website using HTML and CSS. The problem:when accessing the website on a mobile device it will not show all the content, basically parts of the text, buttons, fields are hidden.
Please have a look at the pictures I have attached to have a better understanding. Thanks
mobile view
desktop view
/* ==== Google font ==== */
#import url('https://fonts.googleapis.com/css?family=Noto+Serif:400,400italic,700|Open+Sans:300,400,600,700');
/* === fontawesome === */
#import url('font-awesome.css');
/* ==== overwrite bootstrap standard ==== */
#import url('overwrite.css');
#import url('animate.css');
body {
font-family:'Open Sans', Arial, sans-serif;
font-size:14px;
font-weight:300;
line-height:1.6em;
color:#000;
background-color:#fff;
}
hi,h2,h3,h4,h5,h6 {
color:#000;
line-height:1.1em;
}
p {
color:#000;
}
a:hover {
text-decoration:none;
}
.navbar-default {
margin-top:-10px;
background-color: #fff;
border-radius:0;
border:0;
}
.container-fluid > .navbar-header {
margin-right: 30px;
margin-left: 10px;
margin-top:20px;
border-radius:0;
}
.navbar-brand {
float: left;
height: 30px;
padding: 15px 15px;
font-size: 18px;
line-height: 20px;
}
.navbar-brand h1 {
float: left;
line-height:20px;
padding: 20px;
font-size: 30px;
margin-top:-15px;
color:#6D9C91;
}
.navbar-brand h1:hover {
background-color:#fff;
}
.navbar-brand img{
float: center;
width: 100px;
height: 100px;
margin-top: -35px;
}
.menu {
font-size:14px;
float:right;
text-transform:uppercase;
font-weight:500;
}
.menu ul.nav-tabs li {
color:#000;
}
.nav-tabs {
border-bottom: 0;
}
.nav-tabs > li {
float: left;
margin-bottom: 0;
}
.nav-tabs > li > a {
margin-bottom:20px;
margin-right: 20px;
line-height: 1.42857143;
border-bottom: 3px solid transparent;
border-radius:0;
color:#000;
border-top:0;
border-right:0;
border-left:0;
}
.nav-tabs > li > a:hover {
border-color: #eee #eee #6D9C91;
color: #6D9C91;
border-radius:0;
background-color:#f9f9f9;
}
.nav-tabs > li.active > a,
.nav-tabs > li.active > a:hover,
.nav-tabs > li.active > a:focus {
color: #fff;
cursor: default;
background-color: #6D9C91;
border: 0;
border-bottom-color: transparent;
cursor:pointer;
}
/*===========================
slider
============================ */
.slider {
position: relative;
margin-top:-20px;
}
.slider img {
width: 100%;
}
#carousel-slider {
position: relative;
}
#carousel-slider .carousel-indicators {
bottom: -40px;
}
#carousel-slider .carousel-indicators li {
border: 1px solid #ffbd20;
}
#carousel-slider a i {
border-radius:50%;
font-size: 30px;
height: 50px;
padding: 10px;
position: absolute;
top: 50%;
width: 50px;
color:#6d9c91;
background:#6d9c91;
color:#fff;
}
#carousel-slider a i:hover {
background:#6d9c91;
color:#fff;
border: 1px solid #6d9c91;
}
#carousel-slider
.carousel-control {
width:inherit;
}
#carousel-slider .carousel-control.left i {
left:50px;
top: calc(50% - 50px);
}
#carousel-slider .carousel-control.right i {
right: 50px;
top: calc(50% - 50px);
}
.carousel-caption {
position: absolute;
right: 15%;
top: calc(50% - 150px);
font-size:40px;
left: 15%;
z-index: 10;
padding-bottom: 0px;
color: #fff;
text-align: center;
}
.carousel-caption h2 {
font-size:40px;
color: #fff;
text-transform: uppercase;
}
.carousel-caption h2 span {
font-size:40px;
color: #fff;
}
.carousel-caption p {
font-size:25px;
margin-top:30px;
margin-bottom:20px;
color:#fff;
padding:10px;
}
#media (max-width: 767px) {
.carousel-caption {
font-size: 18px;
}
.carousel-caption h2, .carousel-caption h2 span, .carousel-caption p {
font-size:18px;
}
}
.carousel-inner .form-inline .form-group button[type="livedemo"]{
padding:20px 60px;
font-size:20px;
background:#6d9c91;
color:#fff;
border-radius:0;
border-color:#fff;
text-transform:uppercase;
}
.carousel-inner .form-inline .form-group button[type="livedemo"]:hover {
color:#fff;
opacity: 0.8;
-webkit-transition: color 300ms, background-color 300ms;
-moz-transition: color 300ms, background-color 300ms;
-o-transition: color 300ms, background-color 300ms;
transition: color 300ms, background-color 300ms;
}
.carousel-inner .form-inline .form-group button[type="getnow"]{
padding:20px 60px;
font-size:20px;
background:#fff;
color:#272727;
border-radius:0;
text-transform:uppercase;
}
.carousel-inner .form-inline .form-group button[type="getnow"]:hover {
color:#fff;
border-color:#fff;
background:#6d9c91;
-webkit-transition: color 300ms, background-color 300ms;
-moz-transition: color 300ms, background-color 300ms;
-o-transition: color 300ms, background-color 300ms;
transition: color 300ms, background-color 300ms;
}
#media (max-width: 991px) {
.sign-up-form .form-control {
margin-bottom: 20px;
}
.sign-up-form .btn {
margin-bottom: 20px;
}
}
#media (min-width: 768px) {
.sign-up-form .form-control {
width: 350px;
}
}
.content {
background-color:#f9f9f9;
padding:50px;
text-align:center;
margin-top: -50px;
}
.content span {
color: #154360;
}
.content p {
margin-top:50px;
margin-bottom:30px;
color: #0b5345 ;
}
.breadcrumb {
padding:30px;
}
.breadcrumb h4 {
color:#6D9C91;
text-transform:uppercase;
text-align:center;
font-size:20px;
}
.breadcrumbs {
margin-top:30px;
margin-bottom:30px;
padding:30px;
}
.breadcrumbs h4 {
color:#6D9C91;
text-transform:uppercase;
text-align:center;
font-size:20px;
}
.contents {
margin-top:10px;
}
.contents p {
margin-top:30px;
margin-bottom:30px;
}
.bg {
margin-top:10px;
}
.recent button.btn-primarys h3 {
padding:10px;
font-size:30px;
text-decoration:0;
color:#fff;
}
.align-center {
text-align:center;
background-color:#fff;
color:#000;
padding:60px;
margin-top:30px;
margin-bottom:30px;
}
.align-center p {
margin-top:10px;
margin-bottom:30px;
}
.align-center:hover {
border-bottom: 30px solid transparent;
border-color:#6D9C91;
margin-top:-5px;
-webkit-box-shadow: 1px 2px 2px 4px rgba(204,204,204,1);
-moz-box-shadow: 1px 2px 2px 4px rgba(204,204,204,1);
box-shadow: 1px 2px 2px 4px rgba(204,204,204,1);
}
.boxs {
margin-top:30px;
}
.icon {
margin-top:30px;
margin-bottom:30px;
color:#6D9C91;
}
.ficon i {
color:#6D9C91;
}
/* --- Feature --- */
.feature {
background-color:#f6f6f6;
}
.feature p {
margin-top:-30px;
margin-bottom:30px;
padding:30px;
text-align: center;
font-family: proxima-nova;
font-size: 15px;
}
.feature h1{
font-family: proxima-nova;
font-size: 25px;
}
/* --- Portfolio --- */
.col-md-6{
text-align: center;
color: black;
margin-bottom: 10px;
}
.col-md-4{
text-align: center;
color: black;
margin-bottom: 10px;
}
}
.portfolios {
text-align:center;
margin-top:10px;
margin-bottom:30px;
background-color:#f6f6f6;
padding:90px 0 90px 0;
}
.portfolio {
margin-top:5px;
}
.list-group {
padding-left: 0;
margin-top:50px;
}
.list-group-item {
position: relative;
display: block;
padding: 10px 15px;
margin-bottom: -1px;
background-color: #eee;
border: 1px solid #000;
}
.list-group-item.active {
background-color:#eee;
border-color:#eee;
color:#6D9C91;
}
.list-group-item.active:hover {
background-color:#6D9C91;
border-color:#6D9C91;
}
.list-group-item.active p.list-group-item-text {
color:#000;
}
.image {
margin-top:80px;
}
/* --- Blog --- */
.page-header {
padding-bottom: 9px;
margin: 20px 0 20px;
border-bottom: 1px solid #eee;
border-top: 1px solid #eee;
border-right: 1px solid #eee;
border-left: 1px solid #eee;
margin-top:50px;
}
.blog h5 {
color:#000;
margin-left:20px;
text-transform:uppercase;
margin-top:10px;
}
.blog img {
margin-top:10px;
margin-bottom:10px;
}
.blog h3,p {
color:#000;
padding:15px;
}
.blog .ficon {
text-align:center;
margin-bottom:30px;
}
.form-search .form-control {
margin-top:20px;
}
.media h4 {
color:#000;
margin-bottom:30px;
}
.media-body .ficon {
float:right;
margin-right:30px;
}
.media-body h4 {
color:#000;
}
.media-list {
padding-left: 0;
list-style: none;
margin-left:90px;
margin-bottom:20px;
}
.panel {
margin-top:20px;
margin-bottom: 20px;
background-color: #fff;
border:#eee 1px solid transparent;
border-radius: 0;
-webkit-box-shadow: none;
box-shadow: none;
}
.panel-heading {
padding: 10px 15px;
border-bottom: 1px solid transparent;
border-top-left-radius: 0;
border-top-right-radius: 0;
text-align:center;
}
.panel-default {
border-color: #eee;
border-bottom-color:#eee;
}
.panel-default > .panel-heading {
color: #fff;
background-color: #6D9C91;
border-color: #eee;
}
.panel-default > .panel-heading + .panel-collapse > .panel-body {
border-top-color: #eee;
border-bottom-color:#eee;
}
.panel-default > .panel-footer + .panel-collapse > .panel-body {
border-bottom-color: #eee;
}
.list-group h5 {
color:#fff;
text-align:center;
margin-bottom:-5px;
background:#50c0e9;
padding:15px 20px;
}
.list-group-item {
position: relative;
display: block;
padding: 10px 15px;
margin-bottom: -1px;
background-color: #fff;
border: 1px solid #eee;
color:#000;
}
.list-group-item:first-child {
border-top-left-radius: 0;
border-top-right-radius: 0;
}
.list-group-item:last-child {
margin-bottom: 0;
border-bottom-right-radius: 0;
border-bottom-left-radius: 0;
}
.list-group-item > .badge {
float: right;
border-radius:0;
background-color:#fff;
color:#000;
}
.popular-tags h5 {
color:#6D9C91;
margin-bottom:30px;
text-align:center;
}
.popular-tags ul.tags {
list-style:none;
margin:0;
margin-left: 0;
padding-left:0;
}
.popular-tags ul.tags li {
margin:0 5px 15px 0;
display:inline-block;
}
.popular-tags ul.tags li a {
background:#eee;
color:#333;
padding:5px 10px;
}
.popular-tags ul.tags li a:hover {
text-decoration:none;
color:#fff;
background-color:#6D9C91;
}
/* --- Contact area --- */
form {
margin-top:50px;
margin-bottom:50px;
}
label {
color:#6D9C91;
font-size:14px;
}
.form-group button {
background-color:#6D9C91;
color:#fff;
}
.form-control {
border-radius:0;
}
address {
text-align:center;
font-size:15px;
text-transform:uppercase;
padding-bottom:30px;
color:#333;
}
address br {
margin-top:10px;
}
/* --- Map --- */
.map{
position:relative;
margin-top:50px;
margin-bottom:40px;
}
/* google map */
#google-map{
position:relative;
height: 350px;
}
.widget {
margin-top:10px;
padding:50px;
text-align:center;
}
.widget p,ul {
margin-top:30px;
}
.link-list ul,li,a {
color:#000;
list-style:none;
}
.copyright {
text-align:center;
}
.copyright a {
color:#fff;
}
.sub-footer {
background-color: #6D9C91;
}
ul.social-network {
list-style:none;
margin-top:30px;
text-align:center;
}
ul.social-network li {
display:inline;
margin: 0 5px;
color:#fff;
}
ul.social-network li a {
color:#fff;
}
.credits {
padding-bottom: 15px;
}
.validation {
color: red;
display:none;
margin: 0 0 20px;
font-weight:400;
font-size:13px;
}
#sendmessage {
color: green;
border:1px solid green;
display:none;
text-align:center;
padding:15px;
font-weight:600;
margin-bottom:15px;
}
#errormessage {
color: red;
display:none;
border:1px solid red;
text-align:center;
padding:15px;
font-weight:600;
margin-bottom:15px;
}
#sendmessage.show, #errormessage.show, .show {
display:block;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Kafeyz</title>
<link href="css/bootstrap.min.css" rel="stylesheet">
<link href="css/responsive-slider.css" rel="stylesheet">
<link rel="stylesheet" href="css/animate.css">
<link rel="stylesheet" href="css/font-awesome.min.css">
<link href="css/style.css" rel="stylesheet">
</head>
<body>
<header>
<div class="container">
<div class="row">
<nav class="navbar navbar-default" role="navigation">
<div class="container-fluid">
<div class="navbar-header">
<div class="navbar-brand">
<img src="img/logo.png" alt="logo"/>
</div>
</div>
<div class="menu">
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active">Coffee Shops</li>
<li role="presentation">Coffee Lovers</li>
</ul>
</div>
</div>
</nav>
</div>
</div>
</header>
<div class="slider no-padding-bottom">
<div id="about-slider">
<div id="carousel-slider" class="carousel slide" data-ride="carousel">
<!-- Indicators -->
<div class="carousel-inner">
<div class="item active">
<img src="img/slide1.jpeg" class="img-responsive" alt="">
<div class="carousel-caption no-padding-bottom">
<div class="wow fadeInUp" data-wow-offset="0" data-wow-delay="0.3s">
<h2><span>Take your business to the next level</span></h2>
</div>
<div class="col-md-10 col-md-offset-1">
<div class="wow fadeInUp" data-wow-offset="0" data-wow-delay="0.6s">
<p>A unified platform with everything your coffee shop needs</p>
<p>• mobile app • supplies • marketing • training • staffing solutions</p>
</div>
</div>
<div class="wow fadeInUp" data-wow-offset="0" data-wow-delay="0.9s">
<form class="form-inline margin-top sign-up-form">
<input id="email_intro" type="email" placeholder="enter email address" class="form-control">
<input id="submit_intro" type="submit" value="Get started for FREE" class="btn btn-primary">
</form>
</div>
</div>
</div>
</div>
</div>
<!--/#carousel-slider-->
</div>
<!--/#about-slider-->
</div>
<!--/#slider-->
<div class="content">
</div>
<div class="feature">
<div class="container">
<div class="row">
<div class="col-md-6">
<img src="img/1.jpeg" class="img-responsive" alt="" />
<h1>Mobile Ordering App</h1>
<p>Improve your customers experience with an intuitive mobile ordering app
that will allow them to order their drink and food in advance.
Reduce queues, serve more clients and increase your revenue.
</p>
</div>
<div class="col-md-6">
<img src="img/4.jpeg" class="img-responsive" alt="" />
<h1>Supplies & Equipment</h1>
<p>All the coffee shop supplies you need to offer delicious beverages any time of the day to your customers.
Order products like milk, pastries, and paper goods at competitive prices, with just one invoice.
</p>
</div>
<div class="col-md-6">
<img src="img/5.jpeg" class="img-responsive" alt="" />
<h1>Digital Loyalty Program</h1>
<p>You cannot use paper cards to communicate with customers.
With your digital loyalty program, you now have a direct communication channel.
Send a push notification to your customers and encourage them to visit you again!
</p>
</div>
<div class="col-md-6">
<img src="img/6.jpeg" class="img-responsive" alt="" />
<h1>Customized Mobile Marketing</h1>
<p> You now have access to a wealth of data, allowing you to further tailor your marketing campaigns,
offers, and the entire customer experience to each individual.
</p>
</div>
<div class="col-md-6">
<img src="img/3.jpeg" class="img-responsive" alt="" />
<h1>Staffing Solutions</h1>
<p> Book trained & experienced staff for temp or permanent jobs. Access professional training courses
that will help your staff to maintain the quality of your service to a very high standard.
</p>
</div>
<div class="col-md-6">
<img src="img/2.jpeg" class="img-responsive" alt="" />
<h1>Workspace Bookings</h1>
<p>The rise of the freelance and gig economy is bringing more and more people to coffee shops, where they set up a virtual office to work.
Add a new revenue stream to your business by offering workspace bookings at your café.
</p>
</div>
</div>
</div>
</div>
<!--start footer-->
<footer>
<div class="sub-footer">
<div class="container">
<div class="row">
<div class="col-lg-12">
<ul class="social-network">
<li><i class="fa fa-facebook fa-1x"></i></li>
<li><i class="fa fa-twitter fa-1x"></i></li>
<li><i class="fa fa-linkedin fa-1x"></i></li>
<li><i class="fa fa-pinterest fa-1x"></i></li>
<li><i class="fa fa-google-plus fa-1x"></i></li>
</ul>
</div>
<div class="col-lg-12">
<div class="copyright">
<p>©2018 Kafeyz - All rights reserved.</p>
<div class="credits">
</div>
</div>
</div>
</div>
</div>
</div>
</footer>
<!--end footer-->
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<!-- begin snippet: js hide: false console: true babel: false -->
<script src="js/jquery-2.1.1.min.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
<script src="js/responsive-slider.js"></script>
<script src="js/wow.min.js"></script>
<script>
wow = new WOW({}).init();
</script>
</body>
</html>

Related

On scrolling down a space can be seen above my sidebar

Open the sidebar by clicking on left of Hakuna-Mipaka and just scroll down you will get the problem.
Whenever I open my sidebar and scrolls down then a space can be seen over my sidebar, i want my sidebar to be stick to the navbar even after I scroll it down.
*{
margin:0;
padding:0;
color:#f2f2f2;
box-sizing:border-box;
font-family: "Montserrat", sans-serif;
text-decoration: none;
list-style: none;
}
.nav{
background: #222222;
padding:10px 40px 10px 70px;
border: 1px solid #000;
border-left: none;
border-right: none;
width: 100%;
}
.nav ul{
display:flex;
list-style: none;
flex-wrap:wrap;
align-items: center;
justify-content: center;
}
.nav ul li.logo{
flex:1;
font-size: 30px;
font-weight: 700;
}
.nav ul div.items{
padding: 0 25px;
display: inline-flex;
}
.nav ul div.items a{
text-decoration: none;
font-size:18 px;
padding:0 12px;
}
.nav ul div.items a:hover{
color:cyan
}
.searchicon{
height:40px;
width:240px;
display:flex;
background: #f2f2f2;
border-radius: 5px;
}
.searchicon input{
height:100%;
width:200px;
border:none;
padding:0 10px;
color:#000;
font-size: 16px;
border-radius: 5px 0 0 5px;
}
.searchicon .icon{
height:100%;
width:40px;
line-height: 40px;
text-align:center;
border:1 px solid #cccccc;
border-radius: 0 5px 5px 0;
cursor: pointer;
}
.searchicon .icon:hover{
background: red;
}
.searchicon .icon span{
color:#222222;
font-size: 18px;
}
.sidebar{
position: fixed;
left:-300px;
width:300px;
height:100%;
background:#042331;
transition:all .5s ease;
}
.sidebar header{
font-size:22px;
color:white;
text-align: center;
line-height: 70px;
background:#063146;
user-select: none;
}
.sidebar ul a{
display:block;
height:100%;
width:100%;
line-height:65px;
font-size:20px ;
color:white;
padding-left: 33px;
box-sizing: border-box;
border-top: 1px solid rgba(255,255,255,0.1);
border-bottom: 1px solid black;
transition:0.4s;
}
ul li:hover a{
padding-left: 43px;
}
.sidebar ul a i{
margin-right: 16px;
}
.sidebar ul .setting-btn.show{
display:block;
}
.sidebar span{
position:absolute;
right:10px;
font-size:25px;
margin-top:18px;
pointer-events: none;
}
#check{
display:none;
}
label #btn, label #cancel{
position: absolute;
cursor: pointer;
background:#042331;
border-radius:3px;
}
label #btn{
left:10px;
top:9px;
font-size: 35px;
color:white;
padding:6px 12px;
transition:all .5s;
}
label #cancel{
z-index:1111;
left:-195px;
top:78px;
font-size:30px;
color:#0a5275;
padding:4px 9px;
transition:all .5s ease;
}
#check:checked ~ .sidebar{
left:0;
position: fixed;
}
#check:checked ~ label #btn{
left:250px;
opacity: 0;
pointer-events: none;
}
#check:checked ~ label #cancel{
left:250px;
}
.parent-container{
display:flex;
flex-direction: column;
align-items: flex-end;
margin-top: 0px;
}
.container1{
width:75%;
height:220px;
border:1px solid black;
margin:20px;
padding:10px;
background-color: #e3e4e6;
color: white;
display:flex;
flex-wrap: wrap;
}
.container1-items{
padding:10px;
margin:20px;
font-size:25px;
}
.container1 .container1-items a{
color:slategray;
padding:5px;
}
.container1 .container1-items i{
color:slategray;
}
.container2{
width:75%;
height:220px;
margin:20px;
color: white;
display:flex;
flex-wrap: wrap;
background-color: #FFF;
}
.container2-items{
width:28%;
height:60px;
padding:15px;
margin-right: 34px;
font-size:25px;
border:1px solid black;
color:black;
}
.container3{
width:75%;
height:450px;
border:1px solid black;
margin:20px;
color: white;
display:flex;
flex-wrap: wrap;
}
.container3-header{
height:50px;
border:1px solid black;
background-color: #394263;
color:#FFF;
font-size:20px;
letter-spacing: 1.2px;
padding:10px;
display:flex;
}
.container3-header-link{
letter-spacing: 1.2px;
font-size: 16px;
color:#1BBAE1;
}
.container3-item1{
border:1px solid black;
width:48%;
height:450px;
margin-right:40px;
}
.container3-item2{
border:1px solid black;
width:48%;
height:450px;
display:flex;
flex-direction:column;
}
.container3-item2-1{
width:100%;
height:220px;
border:1px solid black;
margin-bottom: 10px;
}
.container3-item2-1-1{
height:50px;
border:1px solid black;
background-color: #394263;
}
.container3-item2-2{
width:100%;
height:220px;
border:1px solid black;
}
.container3-item2-2-1{
height:50px;
border:1px solid black;
background-color: #394263;
}
<!DOCTYPE html>
<html>
<head>
<title>Dashboard</title>
<link rel="stylesheet" href="index.css">
<script src="https://kit.fontawesome.com/a076d05399.js"></script>
</head>
<body>
<div class="nav">
<ul>
<li class="logo">Hakuna-Mipaka</li>
<div class="items">
<li>Home</li>
<li>About</li>
<li>Services</li>
<li>Contact</li>
</div>
<li class="searchicon">
<input type="search" placeholder="Search">
<label class="icon">
<span class="fa fa-search"></span>
</label>
</li>
</ul>
</div>
<input type="checkbox" id="check">
<label for="check">
<i class="fas fa-bars" id="btn"></i>
<i class="fas fa-times" id="cancel"></i>
</label>
<div class="sidebar">
<header>My Profile</header>
<ul>
<li><i class="fa fa-qrcode"></i>Dashboard</li>
<li><i class="fa fa-home"></i>Home</li>
<li><i class="fa fa-hamburger"></i>My Shop<span class="fas fa-angle-right"></span></li>
<li><a href="#" class="setting-btn"><i class="fa fa-cog"></i>Settings & privacy<span
class="fas fa-angle-right first"></span></a></li>
<li><a href="#"><i class="fa fa-question-circle"></i>Help & support<span
class="fas fa-angle-right"></span></a> </li>
<li><i class="fa fa-user"></i>About us</li>
<li><i class="fa fa-comment-alt"></i>Feedback</li>
</ul>
</div>
<div class="parent-container">
<div class="container1">
<div class="container1-items"><i class="fas fa-hotel"></i>name</div>
<div class="container1-items"><i class="fas fa-address-card"></i>Address</div>
<div class="container1-items"><i class="fas fa-phone-square-alt"></i>Phone_number</div>
<div class="container1-items"><i class="fas fa-building"></i>City</div>
<div class="container1-items"><i class="fas fa-fax"></i>Pincode</div>
</div>
<div class="container2">
<div class="container2-items">1</div>
<div class="container2-items">2</div>
<div class="container2-items">3</div>
<div class="container2-items">4</div>
<div class="container2-items">5</div>
</div>
<div class="container3">
<div class="container3-item1">
<div class="container3-header">
Your <strong>Events</strong>
</div>
</div>
<div class="container3-item2">
<div class="container3-item2-1">
<div class="container3-item2-1-1">
</div>
</div>
<div class="container3-item2-2">
<div class="container3-item2-2-1">
</div>
</div>
</div>
</div>
</div>
</body>
</html>
Open the sidebar by clicking on left of Hakuna-Mipaka and just scroll down you will get the problem.
Whenever I open my sidebar and scrolls down then a space can be seen over my sidebar, i want my sidebar to be stick to the navbar even after I scroll it down.
When opening the menu, the "Hakuna-Mipaka" caption is not obscured by the sidebar box. Everything I changed I marked in the css code.
/*$(window).scroll(function (event) {
var top = $(window).scrollTop();
var height_nav = $(".nav").height();
if (top >= height_nav+22) {
$(".sidebar").css('top', 0);
} else {
$(".sidebar").css('top', height_nav-top+22);
}
});*/
window.addEventListener('scroll', function(e) {
let top = window.pageYOffset;
let height_nav = document.getElementsByClassName('nav')[0].scrollHeight;
let sidebar_top = document.getElementsByClassName('sidebar')[0];
if (top >= (height_nav - 2)) {
sidebar_top.style.top = 0 + 'px' ;
} else {
sidebar_top.style.top = (height_nav - (top - 2)) + 'px' ;
}
});
*{
margin:0;
padding:0;
color:#f2f2f2;
box-sizing:border-box;
font-family: "Montserrat", sans-serif;
text-decoration: none;
list-style: none;
}
.nav{
background: #222222;
padding:10px 40px 10px 70px;
border: 1px solid #000;
border-left: none;
border-right: none;
width: 100%;
}
.nav ul{
display:flex;
list-style: none;
flex-wrap:wrap;
align-items: center;
justify-content: center;
}
.nav ul li.logo{
flex:1;
font-size: 30px;
font-weight: 700;
}
.nav ul div.items{
padding: 0 25px;
display: inline-flex;
}
.nav ul div.items a{
text-decoration: none;
font-size:18 px;
padding:0 12px;
}
.nav ul div.items a:hover{
color:cyan
}
.searchicon{
height:40px;
width:240px;
display:flex;
background: #f2f2f2;
border-radius: 5px;
}
.searchicon input{
height:100%;
width:200px;
border:none;
padding:0 10px;
color:#000;
font-size: 16px;
border-radius: 5px 0 0 5px;
}
.searchicon .icon{
height:100%;
width:40px;
line-height: 40px;
text-align:center;
border:1 px solid #cccccc;
border-radius: 0 5px 5px 0;
cursor: pointer;
}
.searchicon .icon:hover{
background: red;
}
.searchicon .icon span{
color:#222222;
font-size: 18px;
}
.sidebar{
position: fixed;
left:-300px;
width:300px;
/*height:100%;*/
height:100vh; /*add*/
background:#042331;
/*transition:all .5s ease;*/
transition-duration: .5s;
transition-property: left;
}
.sidebar header{
font-size:22px;
color:white;
text-align: center;
line-height: 70px;
background:#063146;
user-select: none;
}
.sidebar ul a{
display:block;
height:100%;
width:100%;
line-height:65px;
font-size:20px ;
color:white;
padding-left: 33px;
box-sizing: border-box;
border-top: 1px solid rgba(255,255,255,0.1);
border-bottom: 1px solid black;
transition:0.4s;
}
ul li:hover a{
padding-left: 43px;
}
.sidebar ul a i{
margin-right: 16px;
}
.sidebar ul .setting-btn.show{
display:block;
}
.sidebar span{
position:absolute;
right:10px;
font-size:25px;
margin-top:18px;
pointer-events: none;
}
#check{
display:none;
}
label #btn, label #cancel{
position: absolute;
cursor: pointer;
background:#042331;
border-radius:3px;
}
label #btn{
left:10px;
top:9px;
font-size: 35px;
color:white;
padding:6px 12px;
transition:all .5s;
}
label #cancel{
z-index:1111;
left:-195px;
top:78px;
font-size:30px;
color:#0a5275;
padding:4px 9px;
transition:all .5s ease;
}
#check:checked ~ .sidebar{
/*position: sticky;*/ /*add*/
/*top: 0;*/ /*add*/
left:0;
/*position: fixed;*/
}
#check:checked ~ label #btn{
left:250px;
opacity: 0;
pointer-events: none;
}
#check:checked ~ label #cancel{
left:250px;
}
.parent-container{
display:flex;
flex-direction: column;
align-items: flex-end;
margin-top: 0px;
}
.container1{
width:75%;
height:220px;
border:1px solid black;
margin:20px;
padding:10px;
background-color: #e3e4e6;
color: white;
display:flex;
flex-wrap: wrap;
}
.container1-items{
padding:10px;
margin:20px;
font-size:25px;
}
.container1 .container1-items a{
color:slategray;
padding:5px;
}
.container1 .container1-items i{
color:slategray;
}
.container2{
width:75%;
height:220px;
margin:20px;
color: white;
display:flex;
flex-wrap: wrap;
background-color: #FFF;
}
.container2-items{
width:28%;
height:60px;
padding:15px;
margin-right: 34px;
font-size:25px;
border:1px solid black;
color:black;
}
.container3{
width:75%;
height:450px;
border:1px solid black;
margin:20px;
color: white;
display:flex;
flex-wrap: wrap;
}
.container3-header{
height:50px;
border:1px solid black;
background-color: #394263;
color:#FFF;
font-size:20px;
letter-spacing: 1.2px;
padding:10px;
display:flex;
}
.container3-header-link{
letter-spacing: 1.2px;
font-size: 16px;
color:#1BBAE1;
}
.container3-item1{
border:1px solid black;
width:48%;
height:450px;
margin-right:40px;
}
.container3-item2{
border:1px solid black;
width:48%;
height:450px;
display:flex;
flex-direction:column;
}
.container3-item2-1{
width:100%;
height:220px;
border:1px solid black;
margin-bottom: 10px;
}
.container3-item2-1-1{
height:50px;
border:1px solid black;
background-color: #394263;
}
.container3-item2-2{
width:100%;
height:220px;
border:1px solid black;
}
.container3-item2-2-1{
height:50px;
border:1px solid black;
background-color: #394263;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<!DOCTYPE html>
<html>
<head>
<title>Dashboard</title>
<link rel="stylesheet" href="index.css">
<script src="https://kit.fontawesome.com/a076d05399.js"></script>
</head>
<body>
<div class="nav">
<ul>
<li class="logo">Hakuna-Mipaka</li>
<div class="items">
<li>Home</li>
<li>About</li>
<li>Services</li>
<li>Contact</li>
</div>
<li class="searchicon">
<input type="search" placeholder="Search">
<label class="icon">
<span class="fa fa-search"></span>
</label>
</li>
</ul>
</div>
<input type="checkbox" id="check">
<label for="check">
<i class="fas fa-bars" id="btn"></i>
<i class="fas fa-times" id="cancel"></i>
</label>
<div class="sidebar">
<header>My Profile</header>
<ul>
<li><i class="fa fa-qrcode"></i>Dashboard</li>
<li><i class="fa fa-home"></i>Home</li>
<li><i class="fa fa-hamburger"></i>My Shop<span class="fas fa-angle-right"></span></li>
<li><a href="#" class="setting-btn"><i class="fa fa-cog"></i>Settings & privacy<span
class="fas fa-angle-right first"></span></a></li>
<li><a href="#"><i class="fa fa-question-circle"></i>Help & support<span
class="fas fa-angle-right"></span></a> </li>
<li><i class="fa fa-user"></i>About us</li>
<li><i class="fa fa-comment-alt"></i>Feedback</li>
</ul>
</div>
<div class="parent-container">
<div class="container1">
<div class="container1-items"><i class="fas fa-hotel"></i>name</div>
<div class="container1-items"><i class="fas fa-address-card"></i>Address</div>
<div class="container1-items"><i class="fas fa-phone-square-alt"></i>Phone_number</div>
<div class="container1-items"><i class="fas fa-building"></i>City</div>
<div class="container1-items"><i class="fas fa-fax"></i>Pincode</div>
</div>
<div class="container2">
<div class="container2-items">1</div>
<div class="container2-items">2</div>
<div class="container2-items">3</div>
<div class="container2-items">4</div>
<div class="container2-items">5</div>
</div>
<div class="container3">
<div class="container3-item1">
<div class="container3-header">
Your <strong>Events</strong>
</div>
</div>
<div class="container3-item2">
<div class="container3-item2-1">
<div class="container3-item2-1-1">
</div>
</div>
<div class="container3-item2-2">
<div class="container3-item2-2-1">
</div>
</div>
</div>
</div>
</div>
</body>
</html>
You must set both x and y offset if you want an element position as fixed. You can fix it by adding top: 0; to #check:checked ~ .sidebar.
Example:
*{
margin:0;
padding:0;
color:#f2f2f2;
box-sizing:border-box;
font-family: "Montserrat", sans-serif;
text-decoration: none;
list-style: none;
}
.nav{
background: #222222;
padding:10px 40px 10px 70px;
border: 1px solid #000;
border-left: none;
border-right: none;
width: 100%;
}
.nav ul{
display:flex;
list-style: none;
flex-wrap:wrap;
align-items: center;
justify-content: center;
}
.nav ul li.logo{
flex:1;
font-size: 30px;
font-weight: 700;
}
.nav ul div.items{
padding: 0 25px;
display: inline-flex;
}
.nav ul div.items a{
text-decoration: none;
font-size:18 px;
padding:0 12px;
}
.nav ul div.items a:hover{
color:cyan
}
.searchicon{
height:40px;
width:240px;
display:flex;
background: #f2f2f2;
border-radius: 5px;
}
.searchicon input{
height:100%;
width:200px;
border:none;
padding:0 10px;
color:#000;
font-size: 16px;
border-radius: 5px 0 0 5px;
}
.searchicon .icon{
height:100%;
width:40px;
line-height: 40px;
text-align:center;
border:1 px solid #cccccc;
border-radius: 0 5px 5px 0;
cursor: pointer;
}
.searchicon .icon:hover{
background: red;
}
.searchicon .icon span{
color:#222222;
font-size: 18px;
}
.sidebar{
position: fixed;
left:-300px;
width:300px;
height:100%;
background:#042331;
transition:all .5s ease;
}
.sidebar header{
font-size:22px;
color:white;
text-align: center;
line-height: 70px;
background:#063146;
user-select: none;
}
.sidebar ul a{
display:block;
height:100%;
width:100%;
line-height:65px;
font-size:20px ;
color:white;
padding-left: 33px;
box-sizing: border-box;
border-top: 1px solid rgba(255,255,255,0.1);
border-bottom: 1px solid black;
transition:0.4s;
}
ul li:hover a{
padding-left: 43px;
}
.sidebar ul a i{
margin-right: 16px;
}
.sidebar ul .setting-btn.show{
display:block;
}
.sidebar span{
position:absolute;
right:10px;
font-size:25px;
margin-top:18px;
pointer-events: none;
}
#check{
display:none;
}
label #btn, label #cancel{
position: absolute;
cursor: pointer;
background:#042331;
border-radius:3px;
}
label #btn{
left:10px;
top:9px;
font-size: 35px;
color:white;
padding:6px 12px;
transition:all .5s;
}
label #cancel{
z-index:1111;
left:-195px;
top:78px;
font-size:30px;
color:#0a5275;
padding:4px 9px;
transition:all .5s ease;
}
#check:checked ~ .sidebar{
left:0;
position: fixed;
top: 0;
}
#check:checked ~ label #btn{
left:250px;
opacity: 0;
pointer-events: none;
}
#check:checked ~ label #cancel{
left:250px;
}
.parent-container{
display:flex;
flex-direction: column;
align-items: flex-end;
margin-top: 0px;
}
.container1{
width:75%;
height:220px;
border:1px solid black;
margin:20px;
padding:10px;
background-color: #e3e4e6;
color: white;
display:flex;
flex-wrap: wrap;
}
.container1-items{
padding:10px;
margin:20px;
font-size:25px;
}
.container1 .container1-items a{
color:slategray;
padding:5px;
}
.container1 .container1-items i{
color:slategray;
}
.container2{
width:75%;
height:220px;
margin:20px;
color: white;
display:flex;
flex-wrap: wrap;
background-color: #FFF;
}
.container2-items{
width:28%;
height:60px;
padding:15px;
margin-right: 34px;
font-size:25px;
border:1px solid black;
color:black;
}
.container3{
width:75%;
height:450px;
border:1px solid black;
margin:20px;
color: white;
display:flex;
flex-wrap: wrap;
}
.container3-header{
height:50px;
border:1px solid black;
background-color: #394263;
color:#FFF;
font-size:20px;
letter-spacing: 1.2px;
padding:10px;
display:flex;
}
.container3-header-link{
letter-spacing: 1.2px;
font-size: 16px;
color:#1BBAE1;
}
.container3-item1{
border:1px solid black;
width:48%;
height:450px;
margin-right:40px;
}
.container3-item2{
border:1px solid black;
width:48%;
height:450px;
display:flex;
flex-direction:column;
}
.container3-item2-1{
width:100%;
height:220px;
border:1px solid black;
margin-bottom: 10px;
}
.container3-item2-1-1{
height:50px;
border:1px solid black;
background-color: #394263;
}
.container3-item2-2{
width:100%;
height:220px;
border:1px solid black;
}
.container3-item2-2-1{
height:50px;
border:1px solid black;
background-color: #394263;
}
<!DOCTYPE html>
<html>
<head>
<title>Dashboard</title>
<link rel="stylesheet" href="index.css">
<script src="https://kit.fontawesome.com/a076d05399.js"></script>
</head>
<body>
<div class="nav">
<ul>
<li class="logo">Hakuna-Mipaka</li>
<div class="items">
<li>Home</li>
<li>About</li>
<li>Services</li>
<li>Contact</li>
</div>
<li class="searchicon">
<input type="search" placeholder="Search">
<label class="icon">
<span class="fa fa-search"></span>
</label>
</li>
</ul>
</div>
<input type="checkbox" id="check">
<label for="check">
<i class="fas fa-bars" id="btn"></i>
<i class="fas fa-times" id="cancel"></i>
</label>
<div class="sidebar">
<header>My Profile</header>
<ul>
<li><i class="fa fa-qrcode"></i>Dashboard</li>
<li><i class="fa fa-home"></i>Home</li>
<li><i class="fa fa-hamburger"></i>My Shop<span class="fas fa-angle-right"></span></li>
<li><a href="#" class="setting-btn"><i class="fa fa-cog"></i>Settings & privacy<span
class="fas fa-angle-right first"></span></a></li>
<li><a href="#"><i class="fa fa-question-circle"></i>Help & support<span
class="fas fa-angle-right"></span></a> </li>
<li><i class="fa fa-user"></i>About us</li>
<li><i class="fa fa-comment-alt"></i>Feedback</li>
</ul>
</div>
<div class="parent-container">
<div class="container1">
<div class="container1-items"><i class="fas fa-hotel"></i>name</div>
<div class="container1-items"><i class="fas fa-address-card"></i>Address</div>
<div class="container1-items"><i class="fas fa-phone-square-alt"></i>Phone_number</div>
<div class="container1-items"><i class="fas fa-building"></i>City</div>
<div class="container1-items"><i class="fas fa-fax"></i>Pincode</div>
</div>
<div class="container2">
<div class="container2-items">1</div>
<div class="container2-items">2</div>
<div class="container2-items">3</div>
<div class="container2-items">4</div>
<div class="container2-items">5</div>
</div>
<div class="container3">
<div class="container3-item1">
<div class="container3-header">
Your <strong>Events</strong>
</div>
</div>
<div class="container3-item2">
<div class="container3-item2-1">
<div class="container3-item2-1-1">
</div>
</div>
<div class="container3-item2-2">
<div class="container3-item2-2-1">
</div>
</div>
</div>
</div>
</div>
</body>
</html>

Bootstrap and my CSS clashed

I'm doing my project for web development and my friend was assigned to do the nav bar. But after i completed my website and pasted his nav bar codes into my codes. It clashed with my bootstrap and thus not displaying correctly. I tried searching for solutions like pasting the link ref after the bootstrap but still up to no avail.
I'll put the CSS code and HTML code here. I'm guessing the classes clashed?
<nav class="navbar">
<ul>
<li><a class="donation" border= href="#donate">DONATE</a></li>
<li class="dropdown">
EVENTS
<div id="specificdays" class="dropdown-content">
World Environment Day
World Ocean Day
World Clean Up Day
World Day to combat Desertification and Drought
</div>
</li>
<li class="dropdown">
PROJECTS
<div class="dropdown-content">
Reward System
Comic Strips & Posters
Make A Pledge
Why a Greenboy
Donate to a cause
</div>
</li>
<li><a id="maintopic" href="#about">ABOUT</a></li>
<li id="logo"><img src="eugene.png" class="logo"></li>
</ul>
</nav>
/CSS/
*{
margin-top:0;
margin-left:0;
margin-right:0;
}
#mainpage{
width:100%;
height:650px;
}
#logo{
float:left;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
}
nav{
position:sticky;
top:0;
z-index:1;
}
li {
float: right;
text-align:center;
padding-right:40px;
padding-top:10px;
display:block;
}
li a, .dropbtn {
display: inline-block;
color: #fff;
text-align: center;
padding: 14px 16px;
text-decoration: none;
font-family:quicksand;
margin-top:5px;
margin-right:-10px;
}
#maintopic{
letter-spacing: 4px;
font-size:13px;
}
.donation{
border:1;
border-size:1px;
letter-spacing: 4px;
font-size:13px;
border-color:#333;
border-style:solid;
cursor:pointer;
border-color:white;
padding:10px 10px 10px 10px;
}
.donation:hover{
background-color:#fff;
color:#333;
}
#maintopic:hover{
border-bottom:2px solid #fff;
}
li .dropdown {
display: inline-block;
}
.dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}
.dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display:block;
text-align: left;
width:128px;
}
#specificdays a{
width:200px;
}
#specificdays a:hover{
width:190px;
}
.dropdown-content a:hover {
background-color: #333;
color:#ddd ;
}
.dropdown:hover .dropdown-content {
display:block;
}
.navbar{
padding:3px;
text-align:center;
color: black;
font-family: sans-serif;
background-color: #333;
}
.logo{
width:140px;
height:60px;
cursor: pointer;
margin-top:-25px;
margin-bottom:-10px;
}
Just rename your class with any unique name which will not be in Bootstrap.For that you can add your website name with class or anything
<nav class="your-theme-navbar">
<ul>
<li><a class="donation" border= href="#donate">DONATE</a></li>
<li class="your-theme-dropdown">
EVENTS
<div id="specificdays" class="your-theme-dropdown-content">
World Environment Day
World Ocean Day
World Clean Up Day
World Day to combat Desertification and Drought
</div>
</li>
<li class="your-theme-dropdown">
PROJECTS
<div class="your-theme-dropdown-content">
Reward System
Comic Strips & Posters
Make A Pledge
Why a Greenboy
Donate to a cause
</div>
</li>
<li><a id="maintopic" href="#about">ABOUT</a></li>
<li id="logo"><img src="eugene.png" class="your-theme-logo"></li>
</ul>
and change these classes in CSS also
*{
margin-top:0;
margin-left:0;
margin-right:0;
}
#mainpage{
width:100%;
height:650px;
}
#logo{
float:left;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
}
nav{
position:sticky;
top:0;
z-index:1;
}
li {
float: right;
text-align:center;
padding-right:40px;
padding-top:10px;
display:block;
}
li a, .dropbtn {
display: inline-block;
color: #fff;
text-align: center;
padding: 14px 16px;
text-decoration: none;
font-family:quicksand;
margin-top:5px;
margin-right:-10px;
}
#maintopic{
letter-spacing: 4px;
font-size:13px;
}
.donation{
border:1;
border-size:1px;
letter-spacing: 4px;
font-size:13px;
border-color:#333;
border-style:solid;
cursor:pointer;
border-color:white;
padding:10px 10px 10px 10px;
}
.donation:hover{
background-color:#fff;
color:#333;
}
#maintopic:hover{
border-bottom:2px solid #fff;
}
li .your-theme-dropdown {
display: inline-block;
}
.your-theme-dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}
.your-theme-dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display:block;
text-align: left;
width:128px;
}
#specificdays a{
width:200px;
}
#specificdays a:hover{
width:190px;
}
.your-theme-dropdown-content a:hover {
background-color: #333;
color:#ddd ;
}
.your-theme-dropdown:hover .your-theme-dropdown-content {
display:block;
}
.your-theme-navbar{
padding:3px;
text-align:center;
color: black;
font-family: sans-serif;
background-color: #333;
}
.your-theme-logo{
width:140px;
height:60px;
cursor: pointer;
margin-top:-25px;
margin-bottom:-10px;
}
Change the name of your defined classes, for example .navbar class in your css file is already included in css file of bootstrap.
If you want use some css of bootstrap and some custom css then just write new class nearby navbar class and target all navbar css with that new class
example
*{
margin-top:0;
margin-left:0;
margin-right:0;
}
#mainpage{
width:100%;
height:650px;
}
#logo{
float:left;
}
ul {
list-style-type: none;
margin: 0;
padding: 0;
overflow: hidden;
}
nav.custom-navbar{
position:sticky;
top:0;
z-index:1;
}
.custom-navbar ul li {
float: right;
text-align:center;
padding-right:40px;
padding-top:10px;
display:block;
}
.custom-navbar ul li a,.custom-navbar ul li a.dropbtn {
display: inline-block;
color: #fff;
text-align: center;
padding: 14px 16px;
text-decoration: none;
font-family:quicksand;
margin-top:5px;
margin-right:-10px;
}
#maintopic{
letter-spacing: 4px;
font-size:13px;
}
.donation{
border:1;
border-size:1px;
letter-spacing: 4px;
font-size:13px;
border-color:#333;
border-style:solid;
cursor:pointer;
border-color:white;
padding:10px 10px 10px 10px;
}
.donation:hover{
background-color:#fff;
color:#333;
}
#maintopic:hover{
border-bottom:2px solid #fff;
}
.custom-navbar ul li .dropdown {
display: inline-block;
}
.custom-navbar ul li .dropdown .dropdown-content {
display: none;
position: absolute;
background-color: #f9f9f9;
min-width: 160px;
box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2);
z-index: 1;
}
.custom-navbar ul li .dropdown .dropdown-content a {
color: black;
padding: 12px 16px;
text-decoration: none;
display:block;
text-align: left;
width:128px;
}
#specificdays a{
width:200px;
}
#specificdays a:hover{
width:190px;
}
.custom-navbar ul li .dropdown .dropdown-content a:hover {
background-color: #333;
color:#ddd ;
}
.custom-navbar ul li .dropdown:hover .dropdown-content {
display:block;
}
.custom-navbar.navbar{
padding:3px;
text-align:center;
color: black;
font-family: sans-serif;
background-color: #333;
}
.logo{
width:140px;
height:60px;
cursor: pointer;
margin-top:-25px;
margin-bottom:-10px;
}
<nav class="navbar custom-navbar">
<ul>
<li><a class="donation" border= href="#donate">DONATE</a></li>
<li class="dropdown">
EVENTS
<div id="specificdays" class="dropdown-content">
World Environment Day
World Ocean Day
World Clean Up Day
World Day to combat Desertification and Drought
</div>
</li>
<li class="dropdown">
PROJECTS
<div class="dropdown-content">
Reward System
Comic Strips & Posters
Make A Pledge
Why a Greenboy
Donate to a cause
</div>
</li>
<li><a id="maintopic" href="#about">ABOUT</a></li>
<li id="logo"><img src="eugene.png" class="logo"></li>
</ul>
</nav>

How to keep this navbar in the center?

Currently I have a header and above it I have my navbar. On my editor it is centered but when I stretch the page or view it in a different format it won't appear to be on top of the center of the header. Any ideas on what I should do?
#nav{
list-style-type: none;
position:absolute;
padding: 0;
overflow: hidden;
margin-top:-25px;
margin-left:50px;
}
#nav li{
float:left;
}
#nav a:link, #nav a:visited {
display: block;
width: 120px;
font-weight: bold;
color: #FFFFFF;
background-color: darkorange;
text-align: center;
padding: 4px;
border:2px solid black;
border-top-right-radius:10px;
border-top-left-radius:10px;
text-decoration: none;
text-transform: uppercase;
border-bottom:none;
}
#nav a:hover{
background-color: orangered;
}
#nav a:active{
color:black;
}
#header{
height:150px;
background-color:darkred;
margin-top:45px;
border:2px solid black;
border-radius:15px;
overflow:hidden;
position:relative;
}
#innerheader{
background-color:burlywood;
height:100px;
margin-left:auto;
margin-right:auto;
overflow:hidden;
width:50%;
border-radius:25px;
border:3px solid black;
position:Relative;
margin-top:22px;
}
#innerheader h1{
position:relative;
margin-left:auto;
text-align:center;
margin-top:30px;
-webkit-text-stroke-width:0.6px;
-webkit-text-stroke-color:black;
color:saddlebrown;
}
<body>
<ul id="nav">
<li>Home</li>
<li>Photos</li>
<li>Statistics</li>
<li>Chat</li>
<li> Biography </li>
</ul>
<div id="header">
<div id="innerheader">
<h1>
General Information
</h1>
</div>
</div>
</body>
Much of what I provided will not be useful to this question, and I apologize for that, but I just want to provide as much information as possible to get help. Thanks!
Hi now try to this css
#nav {
list-style-type: none;
padding: 0;
overflow: hidden;
margin: 0 auto;
display: block;
text-align: center;
font-size: 0;
}
#nav li {
display: inline-block; // add this
font-size: 14px; // add this
}
#header {
/* margin-top: 45px; */ // remove this line
}
Demo
#nav {
list-style-type: none;
/* position: absolute; */
padding: 0;
overflow: hidden;
margin: 0 auto;
/* margin-left: 50px; */
display: block;
text-align: center;
font-size: 0;
}
#nav li {
display: inline-block;
font-size: 14px;
}
#header {
height: 150px;
background-color: darkred;
/* margin-top: 45px; */
border: 2px solid black;
border-radius: 15px;
overflow: hidden;
position: relative;
}
#nav a:link, #nav a:visited {
display: block;
width: 120px;
font-weight: bold;
color: #FFFFFF;
background-color: darkorange;
text-align: center;
padding: 4px;
border:2px solid black;
border-top-right-radius:10px;
border-top-left-radius:10px;
text-decoration: none;
text-transform: uppercase;
border-bottom:none;
}
#nav a:hover{
background-color: orangered;
}
#nav a:active{
color:black;
}
#innerheader{
background-color:burlywood;
height:100px;
margin-left:auto;
margin-right:auto;
overflow:hidden;
width:50%;
border-radius:25px;
border:3px solid black;
position:Relative;
margin-top:22px;
}
#innerheader h1{
position:relative;
margin-left:auto;
text-align:center;
margin-top:30px;
-webkit-text-stroke-width:0.6px;
-webkit-text-stroke-color:black;
color:saddlebrown;
}
<body>
<ul id="nav">
<li>Home</li>
<li>Photos</li>
<li>Statistics</li>
<li>Chat</li>
<li> Biography </li>
</ul>
<div id="header">
<div id="innerheader">
<h1>
General Information
</h1>
</div>
</div>
</body>
Add these properties to your existing classes.
#nav{
list-style-type: none;
position:absolute;
padding: 0;
overflow: hidden;
margin-top:-25px;
margin-left:50px;
width:100%;
text-align:center;
}
#nav li{
display:inline-block;
}
This should solve your issue.
Make your nav bar take full width, and center the inner contents horizontally using text-align:center;

Responsive html the tablet resolution css messes up the desktop resolution css

I'm making a responsive demo website and i'm having trouble with the medium resolution as when i put the css for it in my style sheet the high res no longer works. anyone know why that is/ how to fix it? My code below:
#charset "utf-8";
/* CSS Document */
/* low res or phone */
#media only screen and (max-width: 480px) {
.LoginStuff li
{
display: inline;
float: right!important;
position:relative;
top: -50px;
right: 10px;
}
.reg1 a
{
border-radius: 0px 3px 3px 0px;
border-left-width: 1px;
border-left-style:solid;
border-left-color:#ce542c;
padding: 5px 5px;
font-size:15px;
font-family:Arial;
font-weight:bold;
color: #fff;
background-color:#f7cf1c;
text-decoration:none;
}
.log1 a
{
border-radius: 3px 0px 0px 3px;
border-right-width: 0.5px;
border-right-style:solid;
border-right-color:#ce542c;
padding: 5px 12px;
font-size:15px;
font-family:Arial;
font-weight:bold;
color: #fff;
background-color:#f7cf1c;
text-decoration:none;
}
.nav
{
visibility: hidden;
}
/*start menu*/
.clearfix a
{
background-color:#f7cf1c;
margin-right:auto;
margin-left:auto;
width:277px;
height:30px;
position:relative;
left: -34px;
}
.AMenu
{
margin-right:auto;
margin-left:auto;
padding-left: 100px;
position:relative;
left:35px;
}
.menu-wrap
{
width:100%;
background-color:#f7cf1c;
align-content:center;
margin-right:auto;
margin-left:auto;
}
.menu
{
width:100%;
height:40px;
background-color:#f7cf1c;
position:relative;
margin-left:auto;
margin-right:auto;
}
.menu li {
margin:0px;
text-decoration:none;
list-style:none;
font-family:"Alfa Slab One";
margin-right:auto;
margin-left:auto;
}
.menu a {
transition:all linear 0.15s;
text-decoration:none;
color:#fff;
margin-right:auto;
margin-left:auto;
}
.menu .arrow {
font-size:11px;
line-height:0%;
}
/*----- Top Level -----*/
.menu > ul > li {
display:inline-block;
position:relative;
font-size:19px;
}
.menu > ul > li > a {
padding:10px 40px;
display:inline-block;
}
/*----- Bottom Level -----*/
.menu li:hover .sub-menu {
z-index:1;
opacity:1;
}
.menu li:active .sub-menu {
z-index:1;
opacity:1;
}
.sub-menu {
width:160%;
padding:5px 0px;
position:absolute;
top:100%;
left:0px;
z-index:-1;
opacity:0;
transition:opacity linear 0.15s;
background:#f7cf1c;
}
.sub-menu li {
display:block;
font-size:16px;
}
.sub-menu li a {
padding:10px 30px;
display:block;
}
/*finish menu*/
.topnav
{
margin-bottom: 10px;
}
.mobistrip
{
width: 200px;
height: 200px;
margin-right:auto;
margin-left:auto;
background-color:#f7cf1c;
position:relative;
left: 0px;
}
.createYearbook
{
position:relative;
left:0px;
margin-right:auto;
margin-left:auto;
padding-bottom:20px;
width:350px;
height:50px;
font-family:"Alfa Slab One";
font-size: 15px;
font-weight:lighter;
text-align:center
}
.createYearbook a
{
color: #000;
text-decoration:none;
background-color:#ce542c;
padding: 5px 15px;
border-radius: 3px 3px 3px 3px;
}
.continue
{
position:relative;
left:0px;
margin-right:auto;
margin-left:auto;
width:340px;
height:50px;
text-align:center;
}
.continue a
{
font-size:24px;
font-family:Arial;
font-weight:bolder;
color: #fff;
background-color:#ce542c;
text-decoration:none;
padding: 10px 10px;
border-radius: 3px 3px 3px 3px;
}
.undernav li
{
position:relative;
top: -150px;
display:inline;
height: 50px;
}
.ach
{
width:450px;
height:50px;
padding-top:20px;
padding-bottom:20px;
position:relative;
left:0px;
top: 140px;
}
.ach a
{
font-family:Arial;
font-size:25px;
color:#4e4d4d;
font-weight:bold;
text-decoration:none;
padding-right: 25px;
padding-left: 25px;
padding-bottom:20px;
border-bottom-width:8px;
border-bottom-color:#4e4d4d;
border-bottom-style:solid;
}
.jumbotron
{
visibility: hidden;
padding: 0px;
}
/*choose size Stuff*/
.ChooseSizeA2
{
width:237px;
font-family:Arial;
font-size:15px;
color:#4e4d4d;
font-weight:bold;
background-color:#fff;
position:relative;
top:-900px;
margin-right:auto;
margin-left:auto;
}
.ChooseSize
{
align-content:center;
background-color:#fff;
}
.picksize
{
position:relative;
top:-900px;
left: -15;
margin-right:auto;
margin-left:auto;
}
.sizepics img
{
background-color:#fff;
border-width:6px;
border-color:#f7cf1c;
border-style:solid;
margin-right:auto;
margin-left:auto
}
}
/* med res or ipad */
#media only screen and (min-width: 481px) {
.nav
{
visibility:hidden;
}
.LoginStuff li
{
display: inline;
float: right!important;
position:relative;
top: -50px;
right: 10px;
}
.reg1 a
{
border-radius: 0px 3px 3px 0px;
border-left-width: 1px;
border-left-style:solid;
border-left-color:#ce542c;
padding: 10px 10px;
font-size:20px;
font-family:Arial;
font-weight:bold;
color: #fff;
background-color:#f7cf1c;
text-decoration:none;
}
.log1 a
{
border-radius: 3px 0px 0px 3px;
border-right-width: 0.5px;
border-right-style:solid;
border-right-color:#ce542c;
padding: 10px 20px;
font-size:20px;
font-family:Arial;
font-weight:bold;
color: #fff;
background-color:#f7cf1c;
text-decoration:none;
}
.nav
{
visibility: hidden;
}
/*start menu*/
.clearfix a
{
background-color:#f7cf1c;
margin-right:auto;
margin-left:auto;
width:300px;
height:20px;
padding-bottom:10px;
position:relative;
left: -30px;
}
.AMenu
{
margin-right:auto;
margin-left:auto;
padding-left: 100px;
position:relative;
left:40px;
}
.menu-wrap
{
width:100%;
background-color:#f7cf1c;
align-content:center;
margin-right:auto;
margin-left:auto;
}
.menu
{
width:100%;
height:68px;
background-color:#f7cf1c;
position:relative;
margin-left:auto;
margin-right:auto;
}
.menu li
{
margin:0px;
text-decoration:none;
list-style:none;
font-family:"Alfa Slab One";
margin-right:auto;
margin-left:auto;
position:relative;
top: 15px;
}
.menu a
{
transition:all linear 0.15s;
text-decoration:none;
color:#fff;
margin-right:auto;
margin-left:auto;
}
.menu .arrow
{
font-size:24px;
line-height:0%;
}
/*----- Top Level -----*/
.menu > ul > li
{
display:inline-block;
position:relative;
font-size:24px;
}
.menu > ul > li > a
{
padding:0px 20px;
display:inline-block;
}
/*----- Bottom Level -----*/
.menu li:hover .sub-menu
{
z-index:1;
opacity:1;
}
.menu li:active .sub-menu
{
z-index:1;
opacity:1;
}
.sub-menu
{
width:500px;
height:300px;
padding:0px 0px;
padding-bottom:60px;
padding-top:20px;
padding-left:35px;
position:absolute;
top:100%;
left:-100px;
z-index:-1;
opacity:0;
transition:opacity linear 0.15s;
background:#f7cf1c;
border-radius: 0px 0px 3px 3px;
}
.sub-menu li
{
display:block;
font-size:25px;
}
.sub-menu li a
{
padding:20px 20px;
display:block;
}
/*finish menu*/
.topnav
{
margin-bottom: 10px;
}
.createYearbook
{
position:relative;
left:-10px;
bottom:90px;
margin-right:auto;
float:left;
padding-bottom:50px;
width:500px;
height:70px;
font-family:"Alfa Slab One";
font-size: 14px;
font-weight:lighter;
text-align:center
}
.createYearbook h1
{
width:380px;
}
.createYearbook a
{
color: #000;
text-decoration:none;
background-color:#ce542c;
padding: 15px 30px;
border-radius: 3px 3px 3px 3px;
}
.continue
{
position:relative;
right:-10px;
bottom: 209px;
float:right;
margin-left:auto;
width:400px;
height:70px;
text-align:center;
}
.continue a
{
font-size:28px;
font-family:Arial;
font-weight:bolder;
color: #fff;
background-color:#ce542c;
text-decoration:none;
padding: 17.4px 10px;
border-radius: 3px 3px 3px 3px;
}
.undernav li
{
position:relative;
top: -300px;
display:inline;
height: 50px;
}
.ach
{
width:600px;
height:50px;
padding-top:20px;
padding-bottom:20px;
position:relative;
left:-10px;
top: 140px;
margin-right:auto;
margin-left:auto;
}
.ach a
{
font-family:Arial;
font-size:32px;
color:#4e4d4d;
font-weight:bold;
text-decoration:none;
padding-right: 25px;
padding-left: 25px;
padding-bottom:20px;
border-bottom-width:8px;
border-bottom-color:#4e4d4d;
border-bottom-style:solid;
margin-right:10px;
margin-left:10px;
}
.circlesT
{
visibility:hidden;
}
.jumbotron
{
padding-top: 20px;
background-image:url(http://yourprintsolution.co.uk/littlechickdemo/pics/pic_1.gif);
height: 200px;
background-repeat: no-repeat;
background-size: cover;
position:relative;
top: 10px;
}
.jumbotron .container
{
position: relative;
background-color:transparent;
}
.jumbotron h1
{
color: #fff;
font-size: 20px;
font-family:"Alfa Slab One";
text-outline:#DFDFDF;
background-color:transparent;
padding-left:140px;
position:relative;
bottom:50px;
display: inline;
float: left!important;
margin-right: auto;
}
/*choose size Stuff*/
.ChooseSizeA2
{
width:237px;
font-family:Arial;
font-size:15px;
color:#4e4d4d;
font-weight:bold;
background-color:#fff;
position:relative;
top:-0px;
margin-right:auto;
margin-left:auto;
}
.ChooseSize
{
align-content:center;
background-color:#fff;
}
.picksize
{
position:relative;
top:0px;
left: -15;
margin-right:auto;
margin-left:auto;
}
.sizepics img
{
background-color:#fff;
border-width:6px;
border-color:#f7cf1c;
border-style:solid;
margin-right:auto;
margin-left:auto
}
}
/* high res or computer */
#media only screen and (min-width: 1024px) {
.menu-wrap
{
visibility: hidden;
}
.bg
{
background-color:#fff;
}
.filler
{
width: 100%;
height: 200px;
background-color:#f7cf1c;
}
.fillera
{
padding-top:30px;
background-color:#fff;
}
*
{
background-color:#eae9e9;
}
.LoginStuff li
{
display: inline;
float: right!important;
position:relative;
top: 140px;
}
.reg1 a
{
border-radius: 0px 3px 3px 0px;
border-left-width: 1px;
border-left-style:solid;
border-left-color:#ce542c;
padding: 14px 10px;
font-size:18px;
font-family:Arial;
font-weight:bold;
color: #fff;
background-color:#f7cf1c;
text-decoration:none;
transition-property: background;
transition-duration: 0.3s;
transition-timing-function: ease;
transition-delay: 0;
}
.reg1 a:hover
{
border-radius: 0px 3px 3px 0px;
border-left-width: 1px;
border-left-style:solid;
border-left-color:#ce542c;
padding: 14px 10px;
font-size:18px;
font-family:Arial;
font-weight:bold;
color: #000;
background-color:#ce542c;
text-decoration:none;
}
.log1 a
{
border-radius: 3px 0px 0px 3px;
border-right-width: 1px;
border-right-style:solid;
border-right-color:#ce542c;
padding: 14px 20px;
font-size:18px;
font-family:Arial;
font-weight:bold;
color: #fff;
background-color:#f7cf1c;
text-decoration:none;
transition-property: background;
transition-duration: 0.3s;
transition-timing-function: ease;
transition-delay: 0;
}
.log1 a:hover
{
border-radius: 3px 0px 0px 3px;
border-right-width: 1px;
border-right-style:solid;
border-right-color:#ce542c;
padding: 14px 20px;
font-size:18px;
font-family:Arial;
font-weight:bold;
color: #000;
background-color:#ce542c;
text-decoration:none;
}
.list
{
padding-top:200px;
}
.nav{
padding-top:200px;
}
.nav ul {
padding-left: 0;
}
.nav a {
padding: 30px 20px;
font-size:22px;
font-family:"Alfa Slab One";
color: #fff;
background-color:#f7cf1c;
text-decoration:none;
float: left!important;
margin-right: auto;
transition-property: background;
transition-duration: 0.3s;
transition-timing-function: ease;
transition-delay: 0;
}
.nav a:hover
{
padding: 30px 20px;
font-size:22px;
font-family:"Alfa Slab One";
color: #000;
background-color:#ce542c;
text-decoration:none;
float: left!important;
margin-right: auto;
}
.nav li {
display: inline;
float: left!important;
margin-right: auto;
}
.hide
{
visibility: hidden;
}
.createYearbook
{
padding-top:50px;
width:330px;
height:70px;
font-family:"Alfa Slab One";
font-size:14px;
font-weight:lighter;
float:left;
text-align:left;
}
.createYearbook a
{
color:#f7cf1c;
padding: 10px 10px;
border-radius: 3px 3px 3px 3px;
transition-property: background;
transition-duration: 0.3s;
transition-timing-function: ease;
transition-delay: 0;
text-decoration:none;
}
.createYearbook a:hover
{
color: #fff;
background-color:#f7cf1c;
padding: 10px 10px;
border-radius: 3px 3px 3px 3px;
}
.undernav li
{
display:inline;
padding: 15px 20px;
height: 70px;
}
.ach
{
width:500px;
height:70px;
float:right;
padding-top:50px;
padding-bottom:0px;
}
.ach a
{
font-family:Arial;
font-size:24px;
color:#4e4d4d;
font-weight:bold;
text-decoration:none;
padding: 28px 10px;
border-bottom-width:8px;
border-bottom-color:#eae9e9;
border-bottom-style:solid;
transition-property:all;
transition-duration: 0.3s;
transition-timing-function: ease;
transition-delay: 0;
}
.ach a:hover
{
font-family:Arial;
font-size:24px;
color:#4e4d4d;
font-weight:bold;
text-decoration:none;
padding: 28px 10px;
border-bottom-width:8px;
border-bottom-color:#4e4d4d;
border-bottom-style:solid;
}
.continue
{
width:340px;
height:70px;
float:right!important;
padding-top:50px;
text-align:right;
}
.continue a
{
font-size:24px;
font-family:Arial;
font-weight:bolder;
color: #fff;
background-color:#f7cf1c;
text-decoration:none;
padding: 14px 10px;
border-radius: 3px 3px 3px 3px;
transition-property: background;
transition-duration: 0.3s;
transition-timing-function: ease;
transition-delay: 0;
}
.continue a:hover
{
font-size:24px;
font-family:Arial;
font-weight:bolder;
color: #000;
background-color:#ce542c;
text-decoration:none;
padding: 14px 10px;
border-radius: 3px 3px 3px 3px;
}
.pic img
{
padding-top: 8px;
background-color:transparent;
}
.jumbotron {
padding-top: 20px;
background-image:url(http://yourprintsolution.co.uk/littlechickdemo/pics/pic_1.gif);
height: 500px;
background-repeat: no-repeat;
background-size: cover;
position:relative;
top: 130px;
}
.jumbotron .container {
position: relative;
background-color:transparent;
}
.jumbotron h1 {
color: #fff;
font-size: 44px;
font-family:"Alfa Slab One";
background-color:transparent;
padding-left:380px;
display: inline;
float: left!important;
margin-right: auto;
}
.circlesT
{
padding-top:400px;
background-color:transparent!important;
padding-left:80px;
padding-right:80px;
}
.circlesT a
{
background-color:#fff;
}*
{
background-color:#eae9e9;
}
.thumbnail{
max-width: 360px;
margin-right: auto;
display:inline;
float: left!important;
}
.list
{
padding-top:200px;
}
.a1
{
width:25%;
display:inline;
padding-left:6%;
padding-right:6%;
background-color:#fff;
}
.a1 img
{
background-color:transparent!important;
}
.mobiBG
{
height:91px;
width:100%;
background-color:#f7cf1c;
}
/*Teacher Login Stuff*/
.pagelogin
{
padding-top:20px;
padding-bottom:20px;
padding-left:300px;
}
.Tlogin form
{
background-color:#fff;
}
.Tlogin p
{
background-color:#fff;
}
.Tlogin
{
background-color:#fff;
width:400px;
padding: 20px;
}
/*Choose Size Stuff*/
.ChooseSize
{
padding-top:220px;
align-content:center;
background-color:#fff;
}
.ChooseSize h1
{
background-color:#fff;
}
.ChooseSizeA2
{
width:500px;
font-family:Arial;
font-size:27px;
color:#4e4d4d;
font-weight:bold;
background-color:#fff;
}
.picksize
{
width:100%;
background-color:#fff;
}
.sizepics
{
width:30%;
display:inline;
padding: 10px;
background-color:#fff;
}
.sizepics a
{
background-color:#fff;
border-width:6px;
border-color:#fff;
border-style:solid;
}
.sizepics img
{
background-color:#fff;
border-width:13px;
border-color:#fff;
border-style:solid;
transition-property:all;
transition-duration: 0.3s;
transition-timing-function: ease;
transition-delay: 0;
}
.sizepics img:hover
{
background-color:#fff;
border-width:13px;
border-color:#f7cf1c;
border-style:solid;
}
/*Year Group YG*/
.ChooseYG
{
padding-top:220px;
align-content:center;
background-color:#fff;
}
.ChooseYG h1
{
background-color:#fff;
}
.ChooseYGA2
{
width:800px;
font-family:Arial;
font-size:27px;
color:#4e4d4d;
font-weight:bold;
background-color:#fff;
}
/*Choose Cover 8x8 Stuff*/
.choosecover8x8
{
padding-top:220px;
align-content:center;
background-color:#fff;
}
.choosecover8x8 h1
{
background-color:#fff;
}
.a2-8x8
{
width:500px;
font-family:Arial;
font-size:27px;
color:#4e4d4d;
font-weight:bold;
background-color:#fff;
}
.pickcover8x8
{
width:100%;
background-color:#fff;
}
.cover8x8pics
{
width:30%;
display:inline;
padding: 10px;
background-color:#fff;
}
.cover8x8pics a
{
background-color:#fff;
border-width:6px;
border-color:#fff;
border-style:solid;
}
.cover8x8pics img
{
background-color:#fff;
border-width:13px;
border-color:#fff;
border-style:solid;
transition-property:all;
transition-duration: 0.3s;
transition-timing-function: ease;
transition-delay: 0;
}
.cover8x8pics img:hover
{
background-color:#fff;
border-width:13px;
border-color:#f7cf1c;
border-style:solid;
}
/*Choose Cover 6x8 Stuff*/
.choosecover6x8
{
padding-top:220px;
align-content:center;
background-color:#fff;
}
.choosecover6x8 h1
{
background-color:#fff;
}
.a2-6x8
{
width:500px;
font-family:Arial;
font-size:27px;
color:#4e4d4d;
font-weight:bold;
background-color:#fff;
}
.pickcover6x8
{
width:100%;
background-color:#fff;
}
.cover6x8pics
{
width:30%;
display:inline;
padding: 10px;
background-color:#fff;
}
.cover6x8pics a
{
background-color:#fff;
border-width:6px;
border-color:#fff;
border-style:solid;
}
.cover6x8pics img
{
background-color:#fff;
border-width:13px;
border-color:#fff;
border-style:solid;
transition-property:all;
transition-duration: 0.3s;
transition-timing-function: ease;
transition-delay: 0;
}
.cover6x8pics img:hover
{
background-color:#fff;
border-width:13px;
border-color:#f7cf1c;
border-style:solid;
}
/*Build Yearbook Stuff*/
.BuildYearbook
{
padding-top:220px;
align-content:center;
background-color:#fff;
}
.BuildYearbook h1
{
background-color:#fff;
}
.BuildYearbookA2
{
width:800px;
font-family:Arial;
font-size:27px;
color:#4e4d4d;
font-weight:bold;
background-color:#fff;
}
.price
{
font-family: Arial;
font-size:32px;
color:#e15152;
font-weight:bold;
background-color:#fff;
padding: 20px;
}
.BuildButton
{
padding: 25px;
background-color:#fff;
}
.BuildButton a
{
font-size:30px;
font-family:"Alfa Slab One";
color: #fff;
text-decoration:none;
background-color:#f7cf1c;
text-decoration:none;
border-radius: 3px 3px 3px 3px;
padding: 25px 50px;
transition-property: background;
transition-duration: 0.3s;
transition-timing-function: ease;
transition-delay: 0;
}
.BuildButton a:hover
{
font-size:30px;
font-family:"Alfa Slab One";
color: #000;
background-color:#ce542c;
text-decoration:none;
text-decoration:none;
border-radius: 3px 3px 3px 3px;
padding: 25px 50px;
}
.info
{
font-family:Arial;
font-size:24px;
color:#4e4d4d;
font-weight:bold;
background-color:#fff;
padding:30px;
}
}
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Yearbooks - Size</title>
<link rel="stylesheet" type="text/css" media="all" href="styles1.css">
</head>
<body>
<div class="top">
<div class="thumbnail">
<img src="http://yourprintsolution.co.uk/littlechickdemo/pics/Logo-01.png" width="177" height="183" alt="0">
</div>
<div class="LoginStuff">
<ul>
<div class="reg1"><li class="reg">Register</li></div>
<div class="log1"><li class="login">Login</li></div>
</ul>
</div>
</div>
<!-- Mobile Menu -->
<div class="menu-wrap" align="center">
<nav class="menu" align="center">
<ul class="clearfix">
<li>
<div class="AMenu" align="center">▼</span></div>
<ul class="sub-menu">
<li>Yearbooks</li>
<li>Leaving Cards</li>
<li>Mugs</li>
<li>School Calendars</li>
<li>Teachers Section</li>
</ul>
</li>
</ul>
</nav>
</div>
<!-- Normal Menu -->
<div class="nav" style="height:100%; width:100%;">
<ul>
<div class="Yearbooks"><li>Yearbooks</li></div>
<div class="LeavingCards"><li>Leaving Cards</li></div>
<div class="Mugs"><li>Mugs</li></div>
<div class="SchoolCalendars"><li>School Calendars</li></div>
<div class="TeacherSection"><li>Teachers Section</li></div>
</ul>
</div>
<div class="mobiBG"></div>
<div class="undernav">
<div class="createYearbook">
<h1>Create a Yearbook</h1>
</div>
<div class="continue">
<!-- same as login/register just bold -->
<h2>Continue Your Yearbook</h2>
</div>
<div class="ach" align="center">
<ul>
<li>About</li>
<li>Create</li>
<li>How To</li>
</ul>
</div>
</div>
<div class="jumbotron">
<div class="container">
<h1>Creating a Yearbook is Easy
<br><br>
Simply Choose Your Options Below.
</h1>
</div>
<div class="circlesT" style="background-color:#fff;">
<div class="a1">
<img src="http://yourprintsolution.co.uk/littlechickdemo/pics/circle_test.gif" width="180" height="176" alt=""/>
</div>
<div class="a1">
<img src="http://yourprintsolution.co.uk/littlechickdemo/pics/circle_test.gif" width="180" height="176" alt=""/>
</div>
<div class="a1">
<img src="http://yourprintsolution.co.uk/littlechickdemo/pics/circle_test.gif" width="180" height="176" alt=""/>
</div>
<div class="a1">
<img src="http://yourprintsolution.co.uk/littlechickdemo/pics/circle_test.gif" width="180" height="176" alt=""/>
</div>
</div>
</div>
<div class="bg">
<div class="ChooseSize" align="center">
<div class="ChooseSizeA2">
<h1 align="center">1. Choose a Size</h1>
</div>
</div>
<div class="picksize" align="center">
<div class="sizepics" align="center">
<img src="http://yourprintsolution.co.uk/littlechickdemo/pics/8x6.gif" alt="" width="30%" height="30%">
</div>
<div class="sizepics" align="center">
<img src="http://yourprintsolution.co.uk/littlechickdemo/pics/11x8.gif" alt="" width="30%" height="30%">
</div>
<div class="sizepics" align="center">
<img src="http://yourprintsolution.co.uk/littlechickdemo/pics/8x8.gif" alt="" width="30%" height="30%">
</div>
</div>
<div class="fillera"><div class="filler"></div></div>
</div>
</body>
</html>
That's because of this :
/* med res or ipad */
#media only screen and (min-width: 481px) {
Your media query just use min-width. So every screen with a higher resolution will take CSS rules in it too. Add a max-width rule to it :
/* med res or ipad */
#media only screen and (min-width: 481px) and (max-width: 1023px) {
There's too much css in your example to go through, but perhaps you haven't properly thought through the css for the desktop, as it will be taking the ipad styles as well, considering it too is over 481px.
Try
#media only screen and (min-width: 481px) and (max-width: 1023px)

footer collapses when i add height to content

i've created a page where in the content area I am trying to create two columns using div float left but when i increase the the height of columns my footer collapses. here is the initial fiddle without columns : jsfiddle.net/Vrk5C/ and here is the fiddle with columns in it : jsfiddle.net/GKCT7/
here is the entire code of my html and css
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Contact | Chaithanya Public School</title>
<link rel="stylesheet" href="style.css" />
<link href='http://fonts.googleapis.com/css?family=Open+Sans' rel='stylesheet' type='text/css'>
</head>
<body id="body1">
<div class="container">
<div class="header">
<div style="float:left; width:300px; margin-top:5px;">
<img src="images/logotext.png" /></div>
</div><!-- header ends-->
<div class="menudiv">
<div class="menu">
<ul>
<li>Home</li>
<li>About
<ul>
<li>School</li>
<li>Vision and Mission </li>
<li>Principal’s desk
<li>Management
</ul> </li>
<li>Admission
<ul>
<li>Overview</li>
<li>Download application form</li>
</ul> </li>
<li>Gallery</li>
<li>School Calander</li>
<li>News & Events</li>
<li>Career</li>
<li>Contact</li>
</ul>
</div>
</div><!-- menu div ends-->
<div class="content">
<br />
<div class="heading">Contact</div>
<br />
<br />
</div><!-- Content ends-->
</div><!-- container ends-->
<div class="footer">
<div class="footerbox">
<div class="footerbox1">
<!-- box1 -->
<ul id="footerul">
<p id="footerli" class="footerhead">About</p>
<li>School</li>
<li>Vission & Mission</li>
<li>Management</li>
</ul>
</div> <!-- box1 end -->
<div class="footerbox2"> <!-- box2 -->
<ul id="footerul">
<p id="footerli" class="footerhead">Admission</p>
<li>Overview</li>
<li>Application</li>
<li>Documents</li>
</ul>
</div> <!-- box2 end -->
<div class="footerbox2"> <!-- box3 -->
<ul id="footerul">
<p id="footerli" class="footerhead">School</p>
<li>Calander</li>
<li>Gallery</li>
<li>Careers</li>
</ul>
</div> <!-- box3 end -->
<div class="footerbox2"> <!-- box4 -->
<ul id="footerul">
<p id="footerli" class="footerhead"> Contact</p>
<li style="color:#929497;">082 4227 1080</li>
<li style="color:#929497;">Info#chaithanyaschool.com</li>
<li>Map Directions</li>
</ul>
</div> <!-- box4 end -->
<div class="footerbox3" style="padding-top:45px; padding-left:70px;"> <!-- box5 -->
<table border="0" style="float:right">
<tr>
<td></td>
<td></td> </tr>
</table>
<table border="0" style="float:right; width:220px;">
<tr>
<td id="footerul" style="text-align:right; color:#929497;">© 2013 Chaithanya Public School</td>
</tr><tr>
<td id="footerul" style="text-align:right; color:#929497;">All Rights Reserved</td> </tr>
</table>
</div> <!-- box5 end -->
</div>
</div>
</body>
</html>
body {
margin:0px;
padding:0px;
/* fallback */
background-color: #3A454B;
background: url(images/linear_bg_2.png);
background-repeat: repeat-x;
/* Safari 4-5, Chrome 1-9 */
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#3A454B), to(#2F2727));
/* Safari 5.1, Chrome 10+ */
background: -webkit-linear-gradient(top, #3A454B, #D9E0E6);
/* Firefox 3.6+ */
background: -moz-linear-gradient(top, #3A454B, #D9E0E6);
/* IE 10 */
background: -ms-linear-gradient(top, #3A454B, #D9E0E6);
/* Opera 11.10+ */
background: -o-linear-gradient(top, #3A454B, #D9E0E6);
}
#body
{
background:url(images/head_bg.jpg) repeat-x;
}
#body1
{
/* background:url(images/head_bg1.jpg) repeat-x; */
}
.container
{
width:980px;
min-height:500px;
height:auto;
margin-left:auto;
margin-right:auto;
}
.header
{
width:980px;
height:100px;
}
.slider
{
width:976px;
height:230px;
border: 4px #fff solid;
}
.bar
{
margin-left: auto;
margin-right: auto;
margin-top:10px;
margin-bottom:10px;
padding: 0;
width: 980px;
height:30px;
background:#98AFC7;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
}
.content
{
margin-top:0px;
margin-bottom:10px;
width:980px;
min-height:500px;
height:auto;
background:#fff;
/* border:1px solid #000;
-moz-border-radius: 1px;
-webkit-border-radius: 1px; */
}
.footer
{
padding-top:20px;
height:250px;
background:#111312;
}
.footerbox
{
width:980px;
height:250px;
margin-left:auto;
margin-right:auto;
}
.footerbox1
{
float:left;
height:200px;
width:150px;
}
.footerbox2
{
float:left;
height:200px;
width:150px;
margin-left:3px;
}
.footerbox3
{
float:left;
height:200px;
width:220px;
}
#footerul {
list-style-type:none;
line-height:2.0em;
font-family: 'Droid Sans', sans-serif;
font-size: 12px;
}
#footerul a {
text-decoration:none;
list-style-type:none;
line-height:2.0em;
font-family: 'Droid Sans', sans-serif;
font-size: 12px;
color:#999;
}
#footerul a:hover{
list-style-type:none;
line-height:2.0em;
font-family: 'Droid Sans', sans-serif;
font-size: 12px;
color:#FFF;
}
#footerli {
border-bottom:1px solid #666;
padding-bottom:5px;
}
.footerhead
{
/*color:#C36241; */
color:#81C1ED;
font-size: 14px;
font-family: 'Open Sans', sans-serif;
}
#facebook
{
display: block;
width:32px;
height:32px;
background:url(images/facebook_dark.png) no-repeat;
}
#facebook:hover
{
background:url(images/facebook_active.png) no-repeat;
}
#twitter
{
display: block;
width:32px;
height:32px;
background:url(images/twitter_dark.png) no-repeat;
}
#twitter:hover
{
background:url(images/twitter_active.png) no-repeat;
}
.logotext
{
font-family: 'Open Sans', sans-serif;
color:#FFF;
font-size:37px;
margin:0px;
}
.logotext1
{
font-family: 'Open Sans', sans-serif;
font-size:20px;
margin:0px;
}
.link
{
color:#000;
text-decoration:underline;
}
.link:hover
{
text-decoration:none;
color:#0CC;
}
.text
{
font-family: 'Droid Sans', sans-serif;
font-size:14px;
line-height:25px;
margin:0px;
color:#000;
text-align:justify;
}
.heading
{
font-family: 'Oxygen', sans-serif;
font-size:16px;
padding-left:30px;
color:#4e5c64;
text-align:justify;
}
.heading1
{
font-family: 'Oxygen', sans-serif;
font-size:16px;
padding-left:30px;
color:#999;
text-align:justify;
}
.hblock1
{
width:320px;
height:200px;
background:#88C7F0;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
float:left;
margin-left:4px;
}
.hblock2
{
width:318px;
height:200px;
background:#88C7F0;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
margin-left:10px;
float:left;
}
.hblock3
{
width:318px;
height:200px;
background:#88C7F0;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
margin-left:10px;
float:left;
}
.addressbox
{
width:200px;
height:400px;
float:left;
}
.add
{
width:200px;
height:400px;
float:left;
}
.adressbox1
{
width:300px;
height:150px;
float:left;
margin-top:20px;
}
.adressbox2
{
width:300px;
height:120px;
float:left;
margin-top:10px;
}
.adressbox3
{
width:300px;
height:30px;
float:left;
margin-top:10px;
}
.adressbox4
{
width:300px;
height:30px;
}
.menudiv {
width:980px;
}
.menu {
font-family:'Open Sans', sans-serif;
font-size:14px;
}
.menu ul ul {
display: none;
}
.menu ul li:hover > ul {
display: block;
}
.menu ul {
background: #AEA79F;
margin: 0;
list-style: none;
position: relative;
padding: 0;
-moz-border-radius: 3px;
-webkit-border-radius: 3px;
}
.menu ul:after {
content:"";
clear: both;
display: block;
}
.menu ul li {
float: left;
padding-top: 10px;
padding-bottom: 7px;
border-bottom: 3px solid transparent;
}
.menu ul li:hover {
background: #2C001E;
border-bottom: 3px solid #2C001E;
}
.menu ul li:hover a {
color: #fff;
}
.menu ul li a {
color: #fff;
text-decoration: none;
}
.menu ul ul {
background: #2C001E;
padding: 0;
position: absolute;
top: 100%;
}
.menu ul ul li {
float: none;
position: relative;
}
.menu ul ul li a {
padding: 10px;
color:#000;
display: block;
}
.menu ul ul li a:hover {
background: #111312;
color: #fff;
}
.menu ul ul ul {
position: absolute;
left: 100%;
top:0;
padding: 0;
}
.menu ul ul ul li {
float: none;
border-top: 1px solid #6b727c;
border-bottom: 1px solid pink;
position: relative;
}
.menu ul ul ul li a {
padding: 10px;
color: #fff;
display: block;
}
.menu ul ul ul li a:hover {
background: #95CEF1;
color: #000;
}
.menu ul ul ul ul {
position: absolute;
left: 100%;
top:0;
}
.menu > ul > li > a {
border-right: 1px solid white;
display: block;
padding-left: 25px;
padding-right: 25px;
}
.menu > ul > li:last-child > a {
border-right: 0;
}
here is what iam trying to do :
Clear your floats. Maybe using a <div style="clear: both"></div> just before your content ends:
http://jsfiddle.net/GKCT7/1/
give clear:both to class ".footer"