after adding Max-Width media query, the background image won't disappear - css
this might be a very basic question but i couldn't solve it out:
After adding Max-Width media query I tried to disable the body background-image when the window in certain width ( 714px ) but it didn't work. however, all the other CSS commands work fine on the body except disabling the background-image and having only a color, here is the code below, anyone can help ?
body {
background-color: #737373;
background-image: url(../Images/bkgd.jpg);
background-size: cover;
color: #3A3A3A;
text-align: left;
font-family: advent-pro;
font-style: normal;
margin: 0px;
font-weight: 400;
font-size: 1.8em;
}
.NavListItem {
float: left;
}
.NavListItem a {
margin: 0px;
text-decoration: none;
display: block;
padding-left: 20px;
color: #232323;
font-size: 1.2em;
padding-top: 20px;
padding-bottom: 20px;
padding-right: 20px;
}
.NavListItem a:hover {
color: black;
background-color: aquamarine;
}
section {
background-image: -webkit-linear-gradient(270deg,rgba(255,255,255,1.00) 0%,rgba(255,255,255,0.92) 49.74%,rgba(255,255,255,0.25) 100%);
background-image: -moz-linear-gradient(270deg,rgba(255,255,255,1.00) 0%,rgba(255,255,255,0.92) 49.74%,rgba(255,255,255,0.25) 100%);
background-image: -o-linear-gradient(270deg,rgba(255,255,255,1.00) 0%,rgba(255,255,255,0.92) 49.74%,rgba(255,255,255,0.25) 100%);
background-image: linear-gradient(180deg,rgba(255,255,255,1.00) 0%,rgba(255,255,255,0.92) 49.74%,rgba(255,255,255,0.25) 100%);
font-size: 1.5em;
}
.NavBar {
padding: 0px;
margin: 0px;
list-style-type: none;
overflow: hidden;
}
nav {
background-image: -webkit-linear-gradient(270deg,rgba(255,255,255,1.00) 0%,rgba(201,201,201,1.00) 100%);
background-image: -moz-linear-gradient(270deg,rgba(255,255,255,1.00) 0%,rgba(201,201,201,1.00) 100%);
background-image: -o-linear-gradient(270deg,rgba(255,255,255,1.00) 0%,rgba(201,201,201,1.00) 100%);
background-image: linear-gradient(180deg,rgba(255,255,255,1.00) 0%,rgba(201,201,201,1.00) 100%);
}
footer {
clear: both;
margin: 0PX;
text-align: center;
position: fixed;
left: 0px;
bottom: 0px;
height: 80px;
width: 100%;
padding-top: 56px;
background-image: -webkit-linear-gradient(270deg,rgba(255,255,255,0.00) 0%,rgba(255,255,255,1.00) 78.24%,rgba(255,255,255,1.00) 100%);
background-image: -moz-linear-gradient(270deg,rgba(255,255,255,0.00) 0%,rgba(255,255,255,1.00) 78.24%,rgba(255,255,255,1.00) 100%);
background-image: -o-linear-gradient(270deg,rgba(255,255,255,0.00) 0%,rgba(255,255,255,1.00) 78.24%,rgba(255,255,255,1.00) 100%);
background-image: linear-gradient(180deg,rgba(255,255,255,0.00) 0%,rgba(255,255,255,1.00) 78.24%,rgba(255,255,255,1.00) 100%);
}
.AsideRight {
width: 55%;
clear: right;
float: right;
border-top-right-radius: 50px;
margin-right: 5%;
margin-left: 1%;
padding-left: 2.5%;
padding-right: 2.5%;
margin-top: 30px;
padding-bottom: 42px;
margin-bottom: 68px;
padding-top: 24px;
}
h1 {
font-size: 3em;
font-family: alfa-slab-one;
font-style: normal;
font-weight: 400;
line-height: 1em;
text-align: center;
color: #EFEFEF;
text-shadow: 2px 2px 10px #353535;
}
h2 {
text-align: center;
font-size: 2.em;
font-family: alfa-slab-one;
font-style: normal;
font-weight: 400;
font-size: 1em;
line-height: 2em;
}
.AsideLeft {
width: 28%;
float: left;
margin-right: 1%;
margin-left: 5%;
padding-bottom: 0px;
}
header {
text-align: center;
margin-top: 20px;
margin-bottom: 30px;
}
.NavList {
padding: 0px;
margin: 0px;
list-style-type: none;
overflow: hidden;
}
.container-fluid .navbar-header .navbar-brand {
font-family: alfa-slab-one;
font-style: normal;
font-weight: 400;
color: #3F3F3F;
}
#media (max-width : 714px ){
.AsideLeft {
width: 90%;
float: none;
margin-right: 5%;
margin-left: 5%;
padding-bottom: 0px;
}
.AsideRight {
width: 90%;
clear: right;
float: none;
border-top-right-radius: 50px;
margin-right: 5%;
margin-left: 5%;
}
h1 {
font-size: 2.2em;
font-family: alfa-slab-one;
font-style: normal;
font-weight: 400;
line-height: 1em;
text-align: center;
color: #EFEFEF;
text-shadow: 2px 2px 10px #353535;
}
body {
background-color: #737373;
/* background-image: url(../Images/bkgd.jpg);
*/ background-size: cover;
color: #3A3A3A;
text-align: left;
font-family: advent-pro;
font-style: normal;
margin: 0px;
font-weight: 400;
font-size: 1.8em;
}
}
<!doctype html>
<html><head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Website design</title>
<!-- <link href="css/bootstrap.css" rel="stylesheet" type="text/css"> -->
<link href="css/bootstrap-3.3.7.css" rel="stylesheet" type="text/css">
<link href="Css File/styles.css" rel="stylesheet" type="text/css">
<style type="text/css">
body {
background-image: url(Images/Carousel_4.jpg);
}
</style>
<!--The following script tag downloads a font from the Adobe Edge Web Fonts server for use within the web page. We recommend that you do not modify it.-->
<script>var __adobewebfontsappname__="dreamweaver"</script>
<script src="http://use.edgefonts.net/actor:n4:default;alfa-slab-one:n4:default;aclonica:n4:default;advent-pro:n4:default.js" type="text/javascript"></script>
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
</head>
<body style="padding-top: 70px">
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container-fluid">
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#topFixedNavbar1" aria-expanded="false"><span class="sr-only">Toggle navigation</span><span class="icon-bar"></span><span class="icon-bar"></span><span class="icon-bar"></span></button>
<a class="navbar-brand" href="#">Mazen | First Website Design</a></div>
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="topFixedNavbar1">
<ul class="nav navbar-nav">
<li class="active NavListItem">Home<span class="sr-only">(current)</span></li>
<li class="NavListItem">Portfolio</li>
<li class="NavListItem">Contact</li>
<li class="NavListItem">About </li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>
<header><img src="Images/Logo.png" width="80" height="80" alt=""/></header>
<aside class="AsideLeft">
<h1>What can i create for you</h1>
</aside>
<section class="AsideRight">
<h2> Creating compelling branding </h2>
<p>Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu libero sit amet quam egestas semper. Aenean ultricies mi vitae est. Mauris placerat eleifend leo. Quisque sit amet est et sapien ullamcorper pharetra. Vestibulum erat wisi, condimentum sed, commodo vitae, ornare sit amet, wisi. Aenean fermentum, elit eget tincidunt condimentum, eros ipsum rutrum orci, sagittis tempus lacus enim ac dui. Donec non enim in turpis pulvinar facilisis. Ut felis. Praesent dapibus, neque id cursus faucibus, tortor neque egestas augue, eu vulputate magna eros eu erat. Aliquam erat volutpat. Nam dui mi, tincidunt quis, accumsan porttitor, facilisis luctus, metusloremipsum</p>
</section>
<footer> Copy rights 2017 100% recycled content</footer>
<script src="js/jquery-1.11.3.min.js"></script>
<!-- <script src="js/bootstrap.js"></script> -->
<script src="js/bootstrap-3.3.7.js"></script>
</body>
</html>
Try adding background: none
#media all and (max-width: 712px)
{
background: none;
background-color: #737373;
background-size: cover;
color: #3A3A3A;
text-align: left;
font-family: advent-pro;
font-style: normal;
margin: 0px;
font-weight: 400;
font-size: 1.8em;
}
Related
Dropdown hides before I can hover on the sub menu
Why does my dropdown hide really fast? I must hover quickly to my sub dropdown to make the dropdown still display. I think my problem was on the select but I don't know how to implement it. Here is my code: body { font-family: Verdana, Geneva, sans-serif; padding: 0; margin: 0; } .ic { font-weight: bold; margin-right: 5px; font-size: .9rem; } .wrap { background-color: black; } #topbar { overflow: hidden; padding: 0; width: 1200px; height: 50px; margin: auto; text-transform: uppercase; font-size: .8rem; } .nospace { color: white; } li { margin: 15px; } li.left { float: left; list-style: none; } li.right { float: right; list-style: none; } li a { text-decoration: none; color: aqua; } #banner { background: url(bg1.jpg) no-repeat center; height: 600px; background-size: 1650px; opacity: 0.7; font-family: 'Forum', cursive; font-size: 20px; } ul li { list-style-type: none; padding: 0; margin: 0; position: relative; } nav li { position: relative; } .menubar { width: 1200px; margin: auto; display: block; } .menubar a { padding: 10px; color: black; } .menubar a:hover { color: blue; } .drop-nav { position: relative; } .drop-nav:after { content: "\25BC"; font-size: .5em; display: block; position: absolute; top: 40%; right: 1%; } #content { padding: 0; display: none; height: 0px; z-index: 1; } #content a { color: white; border-bottom: 1px solid black; background-color: rgba(0,0,0,0.5); text-decoration: none; display: block; text-align: center; } #content a:hover { background-color: aqua; } li:hover ul#content { display: block; position: absolute; top: 25px; left: 0px; width: 120px; visibility: visible; } .wrap01 { height: 60px; border-bottom: 1px solid gray; } .isi{ width: 1200px; margin: auto; text-align: center; padding: 20px; } .boxutama{ width: 1200px; margin: auto; padding: 20px; } .boxkecil{ display: inline-block; width: 360px; margin: auto; text-align: center; padding: 15px; } i{ color: blue; } .boxkecil a{ text-decoration: none; } .boxkedua{ overflow: hidden; height: 180px; background-color: black; font-family: 'Forum', cursive; } .isi2{ color: white; width: 1200px; margin: auto; display: block; } .spanleft{ float: left; width: 50%; padding: 20px; padding-left: 100px; margin: auto; } .spanright{ float: right; padding: 20px; padding-right: 100px; margin: auto; line-height: 138px; } .btn1{ margin: auto; border: 1px solid blue; text-transform: uppercase; padding: 10px; text-decoration: none; font-family: Verdana, Geneva, sans-serif; } .boxketiga{ overflow: hidden; width: 1200px; padding: 20px; margin: auto; margin-top: 20px; } .one_half_first{ float: left; padding: 20px; } .one_half{ padding: 20px; float: right; width: 49%; text-align: left; } .gambarcontoh{ width: 480px; height: 400px; padding: 20px; border: 1px solid #D7D7D7; } .tanggal{ margin: 0px; padding: 0px; font-size: .8rem; } .heading{ margin-top: 5px; } .boxkeempat{ font-family: 'Forum', cursive; background-color: black; height: 220px; } .isi3{ width: 1200px; margin: auto; display: block; text-align: center; } .atas { color: white; padding: 20px; padding-top: 20px; } .atas h3{ font-weight: bold; font-size: 20px; } .bawah{ padding-top: 20px; } .btn2{ border: 1px solid white; text-transform: uppercase; padding: 10px; color: white; text-decoration: none; font-family: Verdana, Geneva, sans-serif; } .boxkelima{ } .wraplima{ width: 1500px; margin: auto; padding: 20px; margin-top: 10px; display: block; text-align: center; font-family: Georgia,"Times New Roman",Times,serif; } .isikotak{ width: 250px; margin: auto; margin: 0 15px; display: inline-block; font-family: 'Forum', cursive; font-size: 13px; } .kotakfoto{ margin-top: 20px; border: 1px solid #D7D7D7; } img.foto{ padding: 15px; max-width: 220px; max-height: 320px; -webkit-filter: sepia(100%); filter: sepia(100%); } .kotakkcl{ padding: 5px; position: relative; display: block; left: 37%; width: 157px; margin: -55px; background-color: white; border: 1px solid #d7d7d7; } .kotakkcl h3, p{ margin: auto; } .boxfooter{ background: url(bg11.jpg); } .boxfooter a{ text-decoration: none; color: white; } .ovlay{ background-color: rgba(0,0,0,0.7); } .boxf1{ width: 1200px; margin: auto; } .boxatas1{ text-align: center; color: white; font-family: 'Forum', cursive; padding-top: 40px; margin-bottom: 60px; } .grup{ width: 1200px; margin: auto; margin-top: 10px; } .dalam1{ display: inline-block; text-align: center; margin: 10.3px } .icon{ position: absolute; left: 295px; top: 2759px; } .icon i::before{ padding: 20px; background: linear-gradient(to top right,#000,#666); border-radius: 50%; border:1px solid white; } .icon i{ color: white; border-radius: 50%; padding: 20px; } .dalam{ color: white; padding: 20px; padding-top: 40px; border: 1px solid white; width: 233px; } .footermenu{ margin: auto; margin-top: 20px; background-color: rgba(0,0,0,.5); } .menufooter{ width: 1200px; margin: auto; text-align: center; padding: 20px; } .menufooter a{ padding: 0 20px; text-decoration: none; border-left: 1px solid white; text-align: center; margin: 0, 5px; } .footerbawah{ overflow: hidden; width: 1000px; margin: auto; padding: 20px; color: white; } p.left { float: left; } p.right { float: right; } <!DOCTYPE html> <html> <head> <title>New DPW</title> <link href="new1.css" rel="stylesheet" type="text/css" media="all"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css"> <link href="https://fonts.googleapis.com/css?family=Forum" rel="stylesheet"> </head> <body> <div class="Halaman"> <div class="wrap"> <div id="topbar"> <div class="nospace"> <li class="left"><span class="ic">☏</span> +00 (123) 456 7890</li> <li class="left"><span class="ic">✉</span> info#pajak.go.id</li> <li class="right">Tentang</li> <li class="right">Kontak</li> <li class="right">Login</li> <li class="right">Register</li> <li class="right"><i class="fa fa-home"></i></li> </div> </div> </div> <div id="banner"> <div class="wrap01"> <nav class="menubar"> <li class="left">Sistem Pemberkasan Gudang</li> <li class="right">Peraturan</li> <li class="right"></li> <li class="right"><a class="drop-nav" href="#">Pajak</a> <ul id="content"> Pajak Bangunan Pajak Penghasilan Pajak Kendaraan Pajak Perdagangan </ul> </li> <li class="right"><a class="drop-nav" href="#">Halaman</a> <ul id="content"> Artikel zero 1 </ul> </li> <li class="right">Rumah</li> </nav> </div> </div> <div class="wrapmain"> <main class="utama"> <div class= "isi"> <h3>Risus sed justo tinciduntt</h3> <p>Cras dapibus ipsum vel eleifend commodo eros tortor imperdiet elit eget molestie nisi lectus.</p> </div> <div class="boxutama"> <div class="boxkecil"> <article><i class="fa fa-cubes" style="font-size: 200%;"></i> <h6>Pellentesque libero</h6> <p>A molestie dictum nullam vitae augue nulla phasellus et eleifend mi etiam odio dictum…</p> <footer>Read More »</footer> </article> </div> <div class="boxkecil"> <article><i class="fa fa-css3" style="font-size: 200%;"></i> <h6>Pellentesque libero</h6> <p>A molestie dictum nullam vitae augue nulla phasellus et eleifend mi etiam odio dictum…</p> <footer>Read More »</footer> </article> </div> <div class="boxkecil"> <article><i class="fa fa-dashcube" style="font-size: 200%;"></i> <h6>Pellentesque libero</h6> <p>A molestie dictum nullam vitae augue nulla phasellus et eleifend mi etiam odio dictum…</p> <footer>Read More »</footer> </article> </div> <div class="boxkecil"> <article><i class="fa fa-database" style="font-size: 200%;"></i> <h6>Pellentesque libero</h6> <p>A molestie dictum nullam vitae augue nulla phasellus et eleifend mi etiam odio dictum…</p> <footer>Read More »</footer> </article> </div> <div class="boxkecil"> <article><i class="fa fa-desktop" style="font-size: 200%;"></i> <h6>Pellentesque libero</h6> <p>A molestie dictum nullam vitae augue nulla phasellus et eleifend mi etiam odio dictum…</p> <footer>Read More »</footer> </article> </div> <div class="boxkecil"> <article><i class="fa fa-dropbox" style="font-size: 200%;"></i> <h6>Pellentesque libero</h6> <p>A molestie dictum nullam vitae augue nulla phasellus et eleifend mi etiam odio dictum…</p> <footer>Read More »</footer> </article> </div> </div> </main> </div> <div class="boxkedua"> <div class="isi2"> <div class="spanleft"> <H3>Pajak Negara Indonesia</H3> Pajak adalah pungutan wajib yang dibayar rakyat untuk negara dan akan digunakan untuk kepentingan pemerintah dan masyarakat umum</div> <div class="spanright"> <a class="btn1" href="#">More Information »</a> </div> </div> </div> <div class="boxketiga"> <div class="one_half_first"><img class="gambarcontoh" src="bg1.jpg" alt=""></div> <div class="one_half"> <p class="tanggal">Tanggal, 22 Juli 2018</p> <h3 class="heading">Venenatis erat nunc lorem</h3> <p>Sed pharetra non sollicitudin nec libero curabitur dapibus ex non viverra scelerisque arcu nisl dignissim enim in lacinia dolor libero id urna duis sodales dignissim enim.</p> <blockquote>Interdum integer vestibulum venenatis justo id vulputate mi curabitur ac odio sed diam ullamcorper pulvinar proin tristique odio non suscipit venenatis magna enim convallis arcu vitae blandit turpis</blockquote> <p>Sed pharetra non sollicitudin nec libero curabitur dapibus ex non viverra scelerisque arcu nisl dignissim enim in lacinia dolor libero id urna duis sodales dignissim enim. asfasjkfjkahsjhfjhasj asklfkjaskljfkjaisdfiwe sdkjfkjsdkljiieghwe kjdkfjsidigiosg kasdjklfjkajdklgjioae lasjklfjliajew9fqe ioajsdijiljadg9 ladkjlkgj lkajs fl aksklklfjklajsfioaw asjksjafj asfkjasjfh uasfuiqwio. askljlasjlkfjkasf askljfkljalksjfqowjf eklsdlklisod pfawp fawoifpoiawpoif paw fpawf aw ofoaw f poawpo fpoawipfi iawo weokoriweirpoaiskfokasopifpwea okd po foasofkpoaifpow pojfowifpaw pof.</p> <footer>Read More »</footer> </div> </div> <div class="boxkeempat"> <div class="isi3"> <div class="atas"> <h3>Pajak Negara Indonesia</h3> <p>Pajak adalah pungutan wajib yang dibayar rakyat untuk negara dan akan digunakan untuk kepentingan pemerintah dan masyarakat umum.</p> </div> <div class="bawah"> <a class="btn2" href="#">Sudahkah Anda Membayar Pajak..?</a> </div> </div> </div> <div class="boxkelima"> <div class="wraplima"> <h3>CREATOR OF THIS WEBSITE</h3> <p>Berikut adalah seluruh anggota yang membuat web sederhana ini</p> <div class="isikotak"> <div class="kotakfoto"> <img class="foto" src="maya.jpg" alt=""> </div> <div class="kotakkcl"> <p style="color: blue; font-size: 1.2em;">Staff</p> <h3>M Bima Sakti Admaja</h3> <p>150411100080</p> </div> </div> <div class="isikotak"> <div class="kotakfoto"> <img class="foto" src="maya.jpg" alt=""> </div> <div class="kotakkcl"> <p style="color: blue; font-size: 1.2em;">Staff</p> <h3>M Bima Sakti Admaja</h3> <p>150411100080</p> </div> </div> <div class="isikotak"> <div class="kotakfoto"> <img class="foto" src="maya.jpg" alt=""> </div> <div class="kotakkcl"> <p style="color: blue; font-size: 1.2em;">Staff</p> <h3>M Bima Sakti Admaja</h3> <p>150411100080</p> </div> </div> <div class="isikotak"> <div class="kotakfoto"> <img class="foto" src="maya.jpg" alt=""> </div> <div class="kotakkcl"> <p style="color: blue; font-size: 1.2em;">Staff</p> <h3>M Bima Sakti Admaja</h3> <p>150411100080</p> </div> </div> </div> </div> <div class="boxfooter"> <div class="ovlay"> <div class="boxf1"> <div class="boxatas1"> <h2 class="heading" style="margin-bottom: 10px; text-transform: capitalize;" >dui eu laoreet aenean non</h2> <p>dapibus lacus phasellus quis ligula ut libero venenatis scelerisque</p> </div> <div class="grup"> <div class="dalam1"> <div class="icon"><i class="fa fa-phone fa-lg"></i></div> <div class="dalam"> <div>+62 (009) 340 9549</div> <div>1 (500) 200</div> </div> </div> <div class="dalam1"> <div class="icon" style="left: 588px;"><i class="fa fa-envelope-o fa-lg"></i></div> <div class="dalam"> <div>www.pajak.go.id</div> <div>#DitjenPajakRI</div> </div> </div> <div class="dalam1"> <div class="icon" style="left: 893px;"><i class="fa fa-clock-o fa-lg"></i></div> <div class="dalam"> <div>Sen-Jum: 8.00 - 2.00</div> <div>Sabtu: 9.00 - 1.00</div> </div> </div> <div class="dalam1"> <div class="icon" style="left: 1194px;"><i class="fa fa-support fa-lg"></i></div> <div class="dalam"> <div>Online Support</div> <div>Live Chat</div> </div> </div> </div> </div> <div class="footermenu"> <div class="menufooter"> <i class="fa fa-home fa-lg" style="color: white"></i> TENTANG KONTAK PERATURAN </div> </div> <div class="footerbawah"> <p class="left">Copyright © 2018 - All Rights Reserved - Domain Name</p> <p class="right">Powered by :Trunojoyo.ac.id</p> </div> </div> </div> </div> </body> </html>
The reason why the sub menu closes too quickly is that you have a small gap between the main menu button and the sub menu so the mouse detects its rolled out of the sub menu button and closes. just increase the size of the main menu buttons and that should do it :)
How can I add a space between them and keep text same line
how can I add a space between those 2 images and dont allow the text to break on the center of the page? It's for a college project and I've never programmed before. i actually dont know whats going on on this template i have to edit.. i just need to add a photo of a person in the image circle (which i know how to) and a text of their review, but the images keep going off position and text breaks in the middle.. /* Horizons by TEMPLATED templated.co #templatedco Released for free under the Creative Commons Attribution 3.0 license (templated.co/license) */ #import url("font-awesome.min.css"); #import url("http://fonts.googleapis.com/css?family=Raleway:100,200,300,400,500,600,700,800,900"); /* Basic */ } body { background: #222833; } body, input, select, textarea { color: #555555; font-family: 'Raleway', sans-serif; font-size: 13pt; font-weight: 300; line-height: 1.75em; } a { color: #3ac984; text-decoration: underline; } a:hover { text-decoration: none; } strong, b { font-weight: 700; } em, i { font-style: italic; } p, ul, ol, dl, table, blockquote { margin: 0 0 2em 0; } h1, h2, h3, h4, h5, h6 { color: inherit; font-weight: 700; line-height: 1.75em; margin-bottom: 1em; } h1 a, h2 a, h3 a, h4 a, h5 a, h6 a { color: inherit; text-decoration: none; } h2 { font-size: 1.5em; } h3 { font-size: 1.25em; } sub { font-size: 0.8em; position: relative; top: 0.5em; } sup { font-size: 0.8em; position: relative; top: -0.5em; } hr { border-top: solid 1px #888888; border: 0; margin-bottom: 1.5em; } blockquote { border-left: solid 0.5em #888888; font-style: italic; padding: 1em 0 1em 2em; } section.special, article.special { text-align: center; } header.major { padding-bottom: 4em; } header h2 { margin: 0; padding: 0; font-size: 3em; font-weight: 600; } header .byline { font-size: 1.6em; } footer> :last-child { margin-bottom: 0; } footer.major { padding-top: 3em; } /* Form */ input[type="text"], input[type="password"], input[type="email"], textarea { -moz-appearance: none; -webkit-appearance: none; -o-appearance: none; -ms-appearance: none; appearance: none; background: none; border: solid 1px #888888; color: inherit; display: block; outline: 0; padding: 0.75em; text-decoration: none; width: 100%; } input[type="text"]:focus, input[type="password"]:focus, input[type="email"]:focus, textarea:focus { border-color: #3ac984; } input[type="text"], input[type="password"], input[type="email"] { line-height: 1em; } ::-webkit-input-placeholder { color: inherit; opacity: 0.5; position: relative; top: 3px; } :-moz-placeholder { color: inherit; opacity: 0.5; } ::-moz-placeholder { color: inherit; opacity: 0.5; } :-ms-input-placeholder { color: inherit; opacity: 0.5; } .formerize-placeholder { color: rgba(85, 85, 85, 0.5) !important; } /* Image */ .image { border: 0; position: relative; } .image.fit { display: block; } .image.fit img { display: block; width: 100%; } .image.feature { display: block; margin: 0 0 2em 0; } .image.feature img { display: block; width: 100%; } .image.feature2 { display: block; margin: 0 0 5em 0; } .image.feature2 img { display: block; width: 100%; border-radius: 50%; width: 200px; height: 200px; float: left margin 40px; } /* Icon */ .icon { position: relative; } .icon:before { content: ""; -moz-osx-font-smoothing: grayscale; -webkit-font-smoothing: antialiased; font-family: FontAwesome; font-style: normal; font-weight: normal; text-transform: none !important; } .icon>.label { display: none; } /* Lists */ ol.default { list-style: decimal; padding-left: 1.25em; } ol.default li { padding-left: 0.25em; } ul { margin: 0; padding: 0; } ul.default { list-style: none; } ul.default li { display: block; padding: 0.60em 0; border-top: 1px solid; border-color: rgba(192, 192, 192, 0.15); } ul.default> :first-child { padding-top: 0; border-top: none; } ul.icons { cursor: default; } ul.icons li { display: inline-block; line-height: 1em; padding-left: 0.5em; } ul.icons li:first-child { padding-left: 0; } ul.actions { cursor: default; } ul.actions:last-child { margin-bottom: 0; } ul.actions li { display: inline-block; padding: 0 0 0 1.5em; } ul.actions li:first-child { padding: 0; } ul.actions.vertical li { display: block; padding: 1.5em 0 0 0; } ul.actions.vertical li:first-child { padding: 0; } ul.contact li { padding: 1.05em 0; border-top: 1px solid; border-color: rgba(192, 192, 192, 0.15); } ul.contact li>span { display: inline-block; } ul.contact li .address, ul.contact li .mail, ul.contact li .phone { float: left; width: 100px; font-weight: 600; } ul.contact> :first-child { padding-top: 0; border-top: none; } ul.style li { clear: both; display: block; padding-top: 3em; } ul.style> :first-child { padding-top: 0; } ul.style h3 { display: block; margin: 0; padding-bottom: 0.50em; font-size: 1.1em; font-weight: 700; color: #404040; } ul.style .fa { float: left; display: inline-block; width: 80px; height: 80px; margin-right: 1em; background: #3ac984; line-height: 80px; text-align: center; border-radius: 10px; font-size: 2em; color: white; } ul.list { list-style: none; } ul.list li { display: block; padding: 0.60em 0; border-top: 1px solid; border-color: red; } ul.list> :first-child { padding-top: 0; border-top: none; } /* Tables */ table { width: 100%; } table.default { width: 100%; } table.default tbody tr { border-bottom: solid 1px #888888; } table.default td { padding: 0.5em 1em 0.5em 1em; } table.default th { font-weight: 700; padding: 0.5em 1em 0.5em 1em; text-align: left; } table.default thead { background: #555555; color: #fff; } /* Button */ input[type="submit"], input[type="reset"], input[type="button"], .button { -moz-appearance: none; -webkit-appearance: none; -o-appearance: none; -ms-appearance: none; appearance: none; -moz-transition: background-color 0.2s ease-in-out; -webkit-transition: background-color 0.2s ease-in-out; -o-transition: background-color 0.2s ease-in-out; -ms-transition: background-color 0.2s ease-in-out; transition: background-color 0.2s ease-in-out; background: #3ac984; border-radius: 40px; border: 0; color: white; cursor: pointer; display: inline-block; padding: 0.80em 2em; text-align: center; text-decoration: none; font-size: 1.4em; font-weight: 600; min-width: 10em; } input[type="submit"]:hover, input[type="reset"]:hover, input[type="button"]:hover, .button:hover { background-color: #32b777; } input[type="submit"].fit, input[type="reset"].fit, input[type="button"].fit, .button.fit { width: 100%; } input[type="submit"].small, input[type="reset"].small, input[type="button"].small, .button.small { font-size: 0.8em; } /* Wrapper */ .wrapper.style1 { background: #fff; } .wrapper.style2 { background: #ececec; padding: 6em 0; text-align: center; } .wrapper.style4 { background: #ececec; padding: 1em 0; text-align: center; } .wrapper.style3 { padding: 2em 0 3.5em 0; background: #ececec; } .wrapper.style3 span { display: inline-block; padding-top: 0.80em; font-size: 2em; font-weight: 600; } .wrapper.style3 .button { float: right; } /* Header */ #header { background: #333333 url("../images/pic01.jpg") no-repeat; background-size: cover; color: #fff; padding: 6em 0; text-align: center; background-position: 0% 65%; position: relative; } #header:before { content: ''; position: absolute; left: 0; top: 0; width: 100%; height: 100%; background: rgba(16, 32, 48, 0.25); } #header>* { position: relative; z-index: 1; } .homepage #header { padding: 8em 0; background-position: center; } #logo { font-size: 2em; } #nav>ul { margin: 0; } #nav>ul>li { border-radius: 10px 10px 0 0; display: inline-block; margin-left: 0.5em; padding: 0.5em 1.5em; } #nav>ul>li a { color: #FFF; text-decoration: none; font-size: 1.2em; } #nav>ul>li:first-child { margin-left: 0; } #nav>ul>li:hover a { color: #fff; } #nav>ul>li.active { background: #3ac984; } #nav>ul>li.active a { color: white; } #nav>ul>li>ul { display: none; } /* Dropotron */ .dropotron { margin-top: -2px; background: #3ac984; border-radius: 10px; color: white; min-width: 12em; padding: 1em 0; } .dropotron>li { line-height: 2em; padding: 0 1em; } .dropotron>li>a { color: #FFF; text-decoration: none; } .dropotron>li.active>a, .dropotron>li:hover>a { color: #FFF; } .dropotron.level-0 { border-radius: 0 10px 10px 10px; font-size: 1em; } /* Banner */ #banner { text-align: center; padding: 4em 0 0 0; } #banner .major h2 { font-size: 3.5em; } #banner .major .byline { display: block; margin: 0em 2em; line-height: 1.6em; font-size: 1.5em; } #banner a { color: inherit; } /* Main */ .no-sidebar #main .major, .left-sidebar #main .major, .right-sidebar #main .major { text-align: left; } .homepage #main .major { text-align: center; } #main { padding: 6em 0; } #main .sidebar .major { padding-bottom: 2em; } #main .sidebar .major h2 { font-size: 1.8em; } #main .sidebar .default li { border-color: #cdcdcd; } #main .sidebar .default a { color: #464646; } #main .sidebar> :first-child { margin-bottom: 3em; } /* Footer */ #footer { padding: 4em 0; color: #fff; } #footer .major h2 { font-size: 2em; color: #FFF; } #footer .major .byline { font-size: 1.1em; } #footer .copyright { margin-top: 3em; padding-top: 3em; border-top: 1px solid; border-color: rgba(192, 192, 192, 0.15); text-align: center; color: inherit; } #footer a { color: inherit; } #middle { height: 600px; width: 300px; background: green; } <!DOCTYPE HTML> <!-- Horizons by TEMPLATED templated.co #templatedco Released for free under the Creative Commons Attribution 3.0 license (templated.co/license) --> <html> <head> <title>Horizons by TEMPLATED</title> <meta http-equiv="content-type" content="text/html; charset=utf-8" /> <meta name="description" content="" /> <meta name="keywords" content="" /> <!--[if lte IE 8]><script src="css/ie/html5shiv.js"></script><![endif]--> <script src="js/jquery.min.js"></script> <script src="js/jquery.dropotron.min.js"></script> <script src="js/skel.min.js"></script> <script src="js/skel-layers.min.js"></script> <script src="js/init.js"></script> <noscript> <link rel="stylesheet" href="css/skel.css" /> <link rel="stylesheet" href="css/style.css" /> </noscript> <!--[if lte IE 8]><link rel="stylesheet" href="css/ie/v8.css" /><![endif]--> </head> <body class="homepage"> <!-- Header --> <div id="header"> <div class="container"> <!-- Logo --> <h1>Vista 702</h1> <!-- Nav --> <nav id="nav"> <ul> <li>Fotos</li> <li>Depoimentos</li> <li>Planos</li> </nav> <!-- Banner --> <div id="banner"> <div class="container"> <section> <header class="major"> <h2>Vista 702</h2> <span class="byline">… a melhor vista de Juiz de Fora para se passar o feriado, réveillon e comemorações em geral.</span> </header> Sign Up </section> </div> </div> </div> </div> <!-- Featured --> <div class="wrapper style2"> <section class="container"> <header class="major"> <a id="fotos"></a> <h2>Fotos</h2> <span class="byline">Sua visita começa aqui.</span> </header> <div class="row no-collapse-1"> <section class="4u"> <a class="image feature"><img src="images/pic02.jpg" alt=""></a> <p>Nam in massa. Sed vel tellus. Curabitur sem urna, consequat vel, suscipit in, mattis placerat.</p> </section> <section class="4u"> <a class="image feature"><img src="images/pic03.jpg" alt=""></a> <p>Donec ornare neque ac sem. Mauris aliquet. Aliquam sem leo, vulputate sed, convallis. Donec magna.</p> </section> <section class="4u"> <a class="image feature"><img src="images/pic04.jpg" alt=""></a> <p>Curabitur sem urna, consequat vel, suscipit convallis sem leo, mattis placerat, nulla. Sed ac leo.</p> </section> </div> </section> </div> <div class="wrapper style2"> <section class="container"> <header class="major"> <a id="depoimentos"></a> <h2>Depoimentos</h2> <span class="byline">Os viajantes recomendam.</span> </header> <div class="row no-collapse-1"> <section class=""> <a class="image feature2"><img src="https://abrilexame.files.wordpress.com/2016/09/size_960_16_9_google-robert-bunsen.jpg" align="left"=""></a> <p>Nam in massa. Sed vel tellus. Curabitur sem urna, consequat vel, suscipit in, mattis placerat.</p> </section> <section class=""> <a class="image feature2"><img src="https://eduardhosp-alemao.com.br/wp-content/uploads/2018/05/Hashtag-Google-Alem%C3%A3o-Sem-Complica%C3%A7%C3%A3o.jpg" align="left"></a> <p>Curabitur sem urna, consequat vel, suscipit convallis sem leo, mattis placerat, nulla. Sed ac leo.</p> </section> </div> </section> </div> <!-- Main --> <div id="main" class="wrapper style1"> <section class="container"> <header class="major"> <a id="planos"></a> <h2>Uma janelas, diversas</h2> <span class="byline">Um plano para todos os bolsos.</span> </header> <div class="row"> <!-- Content --> <div class="6u"> <section> <ul class="style"> <li> <span class="fa fa-wrench"></span> <h3>Integer ultrices</h3> <span>In posuere eleifend odio. Quisque semper augue mattis wisi. Maecenas ligula. Pellentesque viverra vulputate enim.</span> </li> <li> <span class="fa fa-cloud"></span> <h3>Aliquam luctus</h3> <span>Pellentesque viverra vulputate enim. Aliquam erat volutpat. Maecenas condimentum enim tincidunt risus accumsan.</span> </li> </ul> </section> </div> <div class="6u"> <section> <ul class="style"> <li> <span class="fa fa-cogs"></span> <h3>Integer ultrices</h3> <span>In posuere eleifend odio. Quisque semper augue mattis wisi. Maecenas ligula. Pellentesque viverra vulputate enim.</span> </li> <li> <span class="fa fa-leaf"></span> <h3>Aliquam luctus</h3> <span>Pellentesque viverra vulputate enim. Aliquam erat volutpat. Maecenas condimentum enim tincidunt risus accumsan.</span> </li> </ul> </section> </div> </div> </section> </div> <!-- Footer --> <div id="footer"> <div class="container"> <!-- Lists --> <div class="row"> <div class="8u"> <section> <header class="major"> <h2>Donec dictum metus</h2> <span class="byline">Quisque semper augue mattis wisi maecenas ligula</span> </header> <div class="row"> <section class="6u"> <ul class="default"> <li>Pellentesque elit non gravida blandit.</li> <li>Lorem ipsum dolor consectetuer elit.</li> <li>Phasellus nibh pellentesque congue.</li> <li>Cras vitae metus aliquam pharetra.</li> </ul> </section> <section class="6u"> <ul class="default"> <li>Pellentesque elit non gravida blandit.</li> <li>Lorem ipsum dolor consectetuer elit.</li> <li>Phasellus nibh pellentesque congue.</li> <li>Cras vitae metus aliquam pharetra.</li> </ul> </section> </div> </section> </div> <div class="4u"> <section> <header class="major"> <h2>Donec dictum metus</h2> <span class="byline">Mattis wisi maecenas ligula</span> </header> <ul class="contact"> <li> <span class="address">Address</span> <span>1234 Somewhere Road #4285 <br />Nashville, TN 00000</span> </li> <li> <span class="mail">Mail</span> <span>someone#untitled.tld</span> </li> <li> <span class="phone">Phone</span> <span>(000) 000-0000</span> </li> </ul> </section> </div> </div> <!-- Copyright --> <div class="copyright"> Design: TEMPLATED Images: Unsplash (CC0) </div> </div> </div> <a id="middle"></a> </body> </html> thanks
Just use white-space: nowrap on the text element to make the text stay on the same line regardless of the parents size. And for the images, you need to either add margin or padding on the parent container. i.e, .4u p { white-space: nowrap; } and .4u{ padding: 0.23em; } or .4u{ margin: 0.23em; }
apparently the footer background went missing too
Edited: This is the changes I made to your code .flex { display: flex; flex-direction: column; justify-content: space-between; } .flex-item + .flex-item { margin-top: 30px; } .image.feature2 { display: block; margin: 0 0 7em 0; } <div class="row no-collapse-1"> <div class="flex"> <section class="flex-item"> <a class="image feature2"><img src="https://abrilexame.files.wordpress.com/2016/09/size_960_16_9_google-robert-bunsen.jpg" align="left" =""></a> <p>Nam in massa. Sed vel tellus. Curabitur sem urna, consequat vel, suscipit in, mattis placerat.</p> </section> <section class="flex-item"> <a class="image feature2"><img src="https://eduardhosp-alemao.com.br/wp-content/uploads/2018/05/Hashtag-Google-Alem%C3%A3o-Sem-Complica%C3%A7%C3%A3o.jpg" align="left"></a> <p>Curabitur sem urna, consequat vel, suscipit convallis sem leo, mattis placerat, nulla. Sed ac leo.</p> </section>
Document flow and grid height making elements appear below grid.
Having just picked up grid I am having some issues when a site is being viewed in mobile. If I set a grid to have a height of 1200px then any elements after this should appear in normal document flow, right? So how do we deal with this on mobile when a grid is stretched further than its original height value because from what I am experiencing the element after the grid is following the normal document flow and expecting the grid to be finished at 1200px and as a result appears behind the grid element. Here is a gif to illustrate if anyone could shed light on this it would be super helpful all mark up below also (note on JS fiddle this "bug" does not exhibit itself) https://gyazo.com/1f3d18693c8df5a339fb5fdc09e8d2c6 HTML <!DOCTYPE html> <html lang="" dir="ltr"> <head> <meta charset="utf-8"> <title>Divine Tofu - Vegan Art and Apparel</title> <link rel="stylesheet" href = "style/style.css" type = "text/css"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link href="https://fonts.googleapis.com/css?family=Permanent+Marker" rel="stylesheet"> <link href="https://fonts.googleapis.com/css?family=Work+Sans" rel="stylesheet"> <link href="https://fonts.googleapis.com/css?family=Shadows+Into+Light+Two" rel="stylesheet"> <link href="https://fonts.googleapis.com/css?family=PT+Sans" rel="stylesheet"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> <script src = "js/menuscript.js"></script> </head> <body> <nav id="wrapper"> <div class="sideSpacer"> <div id="logoCont"> <img id="logo" src="images/navicons/logo.png" alt="Devine Tofu Logo" /> <div id="logoText"><img id = "logo" class="logotext" src="images/navicons/logotext.png"></div> </div> <div id="navWrapper"> <ul> <a href="#apparel"> <li>Apparel</li> </a> <a href="#gal"> <li>Gallery</li> </a> <a href="#contactmetitle"> <li>Contact</li> </a> <a href="https://www.etsy.com/uk/shop/DivineTofu"> <li>Etsy Store</li> </a> </ul> </div> <div id="logoCont"> <img id = "logo" class="logobot" src="images/navicons/bottomCircle.png" alt="Devine Tofu Logo" /> </div> <div id="smWrap"> <ul id="smItems"> <li><img class="icon" src="images/navicons/fb.png" /></li> <li><img class="icon" src="images/navicons/insta.png" /></li> <li><img class="icon" src="images/navicons/twitter.png" /></li> </ul> </div> </div> <a href="https://www.etsy.com/uk/shop/DivineTofu"> Etsy Store </a> </nav> <div id = "grid"> <div id = "grid-item1"> <h1>Commissions</h1> <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam vehicula, felis ut tempus pulvinar, lorem urna imperdiet velit, ac semper lectus dolor at odio. Proin vitae sapien ex. Sed at varius diam. Fusce sit amet nulla lacinia, sodales leo eu, porta urna. Vestibulum rhoncus facilisis nisl vel dapibus. Vestibulum mollis egestas bibendum. Curabitur fringilla felis vitae nunc efficitur viverra. Nunc eleifend faucibus sodales. Donec libero magna, efficitur vel nisi non, tempus tincidunt quam.</p> <!-- Slider --> <img src = "images/Gallery/gallery3.png"> </div> <div id = "grid-item2"> <h1>Warcraft Chibis</h1> <br> <p>Sed commodo turpis in nulla ultricies, ac volutpat turpis tristique. Sed a turpis dictum, posuere arcu sit amet, sodales eros. Maecenas in eleifend lacus. Phasellus mattis eros et justo egestas pharetra. Etiam ac tortor ut orci dapibus laoreet.</p> </div> <div id = "grid-item3"> <img src = "images/chibi/tcomm5.png" id = "imgtrans"> <img src = "images/chibi/tcomm1.png" id = "imgtrans"> <img src = "images/chibi/tcomm3.png" id = "imgtrans"> <img src = "images/chibi/tcomm2.png" id = "imgtrans"> <img src = "images/chibi/tcomm7.png" id = "imgtrans"> <img src = "images/chibi/tcomm10.png" id = "imgtrans"> </div> <div id = "grid-item4"> <br> <h1>Original Artwork</h1> <br> <p>Sed commodo turpis in nulla ultricies, ac volutpat turpis tristique. Sed a turpis dictum, posuere arcu sit amet, sodales eros. Maecenas in eleifend lacus. Phasellus mattis eros et justo egestas pharetra. Etiam ac tortor ut orci dapibus laoreet.</p> </div> <div id = "grid-item5"> <img src = "images/Gallery/icongall1.png" id = "imgtrans"> <img src = "images/Gallery/icongall6.png" id = "imgtrans"> <img src = "images/Gallery/icongall3.png" id = "imgtrans"> <img src = "images/Gallery/icongall4.png" id = "imgtrans"> <img src = "images/Gallery/icongall5.png" id = "imgtrans"> <img src = "images/Gallery/icongall2.png" id = "imgtrans"> </div> </div> <!--This is the red bar --> <div class = "aftergrid"> </div> </body> </html> CSS *{ box-sizing: border-box; } .aftergrid { width: 100%; height: 40px; background-color: red; } #grid { margin: 0 auto; display: grid; max-width: 100%; height:1200px; grid-template-columns: repeat(1, 1fr); grid-template-rows: repeat(8,1fr); grid-gap: 5px 5px; } #grid div { background-color: hsla(126, 100%, 100%, 0.63); box-shadow: 0px 20px 250px 10px #fffdd0 inset; } #grid:after { visibility: hidden; display: block; font-size: 0; content: " "; clear: both; height: 0; } .fixed-width { max-width: 90%; margin:0 auto; } h1 { text-align: center; } #grid-item1{ background-color: aliceblue; text-align: center; } #grid-item1 p{ position: relative; margin-bottom: 1em; padding: 1em; animation-name: fadeinleft; animation-duration: 1s; animation-timing-function: ease-in-out; } #grid-item1 h1 { position: relative; animation-name: fadeinright; animation-duration: 1s; animation-timing-function: ease-in-out; } #keyframes fadeinleft{ 0% {left:-50px; opacity: 0; } 80% {left: 10px; } 100% {left:0px; opacity: 1;} } #keyframes fadeinright { 0% {left:50px; opacity: 0; } 80% {left: -10px; } 100% {left:0px; opacity: 1;} } #grid-item1>img{ width: 80%; } #grid-item2{ grid-row: 4/5; background-color: aliceblue; display: flex; flex-direction: column; align-items: center; } #grid-item2 p { padding: 1em; display: flex; } #grid-item3{ grid-row: 5/6; background-color: aliceblue; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; } #grid-item4{ grid-row: 6/7; background-color: aliceblue; display: flex; flex-direction: column; align-items: center; } #grid-item4 p { padding:1em; } #grid-item5{ grid-row: 7/8; background-color: aliceblue; display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; } .icon { max-width: 80%; margin: 0 auto; } #imgtrans{ width: 32%; transition: all .2s ease-in-out; padding: 5px; overflow: auto; position: relative; z-index: 3; } #imgtrans:hover{ transform: scale(1.1); } #navWrapper ul li:hover { opacity: 1; filter: alpha(opacity=0.5); background-color: rgba(255, 74, 1, 0.54); } #navWrapper ul { margin: 0 auto; width:96%; } #navWrapper ul li { text-align: center; margin: 10px 5px 10px 0px; padding: 1%; color:white; opacity: 0.6; transition: background-color 0.25s, opacity 0.25s ease-in; border-radius: 10px 10px 10px 10px; -moz-border-radius: 10px 10px 10px 10px; -webkit-border-radius: 10px 10px 10px 10px; width:98%; font-size: 28px; font-family: 'Shadows Into Light Two', cursive; } #navWrapper ul a { text-decoration: none; } #parallax { background-image: url(../images/parallaxbg.png); background-attachment: fixed; background-position: center; background-repeat: no-repeat; background-size: cover; position: fixed; opacity: 0.1; height: 100%; width: 100%; z-index: 0; margin: 0 auto; } .sideSpacer { position:fixed; top:0; left:0; height:100vh; width:220px; background-color: hsla(36, 100%, 50%, 0.80); z-index: 2; transition: width .5s ease-out; } .sideSpacer:hover { width:250px; } #flexcont{ display: block; } #flexlist{ height: 100%; transition: all 1s; } #navIcons { display: flex; flex-direction: row; justify-content: space-between; } .mobileLogo { width:100px; height: 100px; } .mobileNavButton { width: 50px; height: 50px; align-self: center; margin-right: 15px; } .mobileNavButton:hover { cursor: pointer; } #smWrap { width:100%; } #smItems{ display: flex; flex-direction: row; flex-wrap: wrap; justify-content: space-around; } #smItems li{ text-align: center; opacity: 0.6; width:66px; margin-bottom: 10px; transition: width 2s, opacity 0.25s ease-in; } #smItems li:hover { opacity: 0.9; } #logoCont{ margin:0 auto; width:100%; } #logoCont{ font-weight: bold; width: 100%; opacity: 0.8; color:white; transition: width 2s, opacity 0.5s ease-in; } #logoCont:hover { opacity: 1; filter: alpha(opacity=0.5); } #logo{ max-width: 94%; margin-left:3%; margin-right:3%; margin-top: 5%; } #logoText { text-align: center; } .logobot{ max-width: 80%; margin:10%; padding-top: 1em; } #topNav { width: 100%; background-color: hsla(36, 100%, 50%, 0.80); } /* Tablet */ #media only screen and (min-width: 500px) { #grid { max-width: 90%; margin: 0 auto; } .fixed-width { width: 80%; margin: 0 auto; } } #media only screen and (max-width: 900px){ .sideSpacer { display:none; } } /* Desktop */ #media only screen and (min-width: 900px) { #grid { width: 70%; grid-template-columns: repeat(8, 1fr); grid-template-rows: repeat(12,1fr); grid-gap: 5px 5px; margin-left: 25%; } #grid-item1{ grid-row: 2/12; grid-column: 5/9; background-color: aliceblue; } #grid-item2{ grid-row: 1/4; grid-column: 1/4; background-color: aliceblue; } #grid-item3{ grid-row: 4/7; grid-column: 1/4; background-color: aliceblue; } #grid-item4{ grid-row: 7/10; grid-column: 1/4; background-color: aliceblue; } #grid-item5{ grid-row: 10/13; grid-column: 1/4; background-color: aliceblue; } #topNav { display: none; } .aftergrid { margin-top: 25px; } }
I have solved it I should have been using height auto all along.
Footer on the bottom of the page and stop moving the text while hovering over dropdown menu
I'm trying to make my footer to be always displayed on the bottom of the page when there is no enough content. I've tried several solutions but none of them worked. Also, there is a small issue with the dropdown menu - the text moves when I hover over this component. What should I change in my CSS? Thanks! $(document).ready(function(){ $('li').hover(function(){ $(this).find('ul>li').stop().slideToggle(250); }); }); body { font-family: 'Roboto Condensed', sans-serif; font-size: 18px; color: #333; } p { padding: 10px; } #navigation ul { margin: 0; padding: 0; width: auto; list-style-type: none; text-align: center; display: inline-block; } #navigation { text-align: center; } #navigation ul li { float: left; font-weight: bold; font-size: 20px; line-height: 40px; text-align: center; text-shadow: 1px 1px 1px #000; width: 140px; } #navigation ul li:hover { background: #9D9FA4; border-radius: 10px; } ul li a { text-decoration: none; color: #FFFFFF; } ul li li { background: #3F61A9; color: #fff; display: none; } ul li li:hover { background: #9D9FA4; } ul li li a{ text-decoration: none; color: #fff; } #wrapper { margin: 0 auto; width: 1000px; } #headerwrap { width: 1000px; float: left; margin: 0 auto; position: relative; } #header { height: 125px; background: #000000; border-radius: 10px; border: 1px solid #000000; margin: 5px; position: relative; } #navigationwrap { width: 1000px; float: left; margin: 0 auto; position: relative; } #navigation { height: 40px; background: #52bf6e; border-radius: 10px; border: 1px solid #3ea858; margin: 5px; } #contentwrap { width: 700px; float: left; margin: 0 auto; } #content { background: #FFFFFF; border-radius: 10px; margin: 5px; } #leftcolumnwrap { width: 150px; float: left; margin: 0 auto; } #leftcolumn { border-radius: 10px; margin: 5px; } #rightcolumnwrap { width: 150px; float: left; margin: 0 auto; } #rightcolumn { border-radius: 10px; margin: 5px; } #footerwrap { width: 1000px; float: left; margin: 0 auto; clear: both; } #footer { height: 40px; background: #9D9FA4; border-radius: 10px; border: 1px solid #888a91; margin: 5px; background-color: #9D9FA4; text-align: center; color: #FFFFFF; font-weight: bold; } #navigationwrap_placeholder { display:none; height: 40px; } <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> </head> <body> <div id="wrapper"> <div id="headerwrap"> <div id="header"> </div> </div> <div id="navigationwrap"> <div id="navigation"> <ul> <li>main menu</li> <li><a>test</a> <ul class="sub-menu"> <li>test1</li> <li>test2</li> <li>test3</li> <li>test4</li> </ul> </li> </ul> </div> </div> <div id="navigationwrap_placeholder"></div> <div id="leftcolumnwrap"> <div id="leftcolumn"> <p></p> </div> </div> <div id="contentwrap"> <div id="content"> <br><br> <p>Sed lacinia, urna non tincidunt mattis, tortor neque adipiscing diam, a cursus ipsum ante quis turpis. Nulla facilisi. Ut fringilla. Suspendisse potenti. Nunc feugiat mi a tellus consequat imperdiet. Vestibulum sapien. Proin quam. Etiam ultrices. Suspendisse in justo eu magna luctus suscipit. Sed lectus. Integer euismod lacus luctus magna. Quisque cursus, metus vitae pharetra auctor, sem massa mattis sem, at interdum magna augue eget diam. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Morbi lacinia molestie dui. Praesent blandit dolor. </p> <br><br> </div> </div> <div id="rightcolumnwrap"> <div id="rightcolumn"> <p></p> </div> </div> <div id="footerwrap"> <div id="footer"> </div> </div> </div> </body> </html>
You need to use position:fixed to put the footer at the bottom of the page. #footerwrap { width: 1000px; margin: 0 auto; position: fixed; bottom:0; } As for the text shifting slideToggle seems to be shifting the padding of the test list item. By setting the padding in the style itself it fixes the problem. <li ><a style="padding:0 38%">test</a>
Here is a working snippet that solves your navigation issue. I added comments in the CSS so you can better understand what changes I made. I used some flex-box to fix the issue. Super simple. As for the footer, there are lots of ways you can achieve this so I will post a link to an article that shows you 5 different ways to do it and you can pick whichever one works best for your use case. Hope this helps :) P.S. As a side note, I noticed in your markup that you had a class called sub-menu which is not being used in your CSS. Not a big deal just thought I'd point it out. You probably have plans for it later on. Here are some footer options $(document).ready(function() { $('li').hover(function() { $(this).find('ul>li').stop().slideToggle(250); }); }); body { font-family: 'Roboto Condensed', sans-serif; font-size: 18px; color: #333; } p { padding: 10px; } /* removed display property as it was not needed display inline-block was causing the nav item to shift over*/ #navigation ul { margin: 0; padding: 0; width: auto; list-style-type: none; } #navigation { text-align: center; } #navigation ul li { float: left; font-weight: bold; font-size: 20px; line-height: 40px; text-align: center; text-shadow: 1px 1px 1px #000; width: 140px; } #navigation ul li:hover { background: #9D9FA4; border-radius: 10px; } ul li a { text-decoration: none; color: #FFFFFF; } ul li li { background: #3F61A9; color: #fff; display: none; } ul li li:hover { background: #9D9FA4; } ul li li a { text-decoration: none; color: #fff; } #wrapper { margin: 0 auto; width: 1000px; } #headerwrap { width: 1000px; float: left; margin: 0 auto; position: relative; } #header { height: 125px; background: #000000; border-radius: 10px; border: 1px solid #000000; margin: 5px; position: relative; } #navigationwrap { width: 1000px; float: left; margin: 0 auto; position: relative; } /* Added display flex to container with justify-content center to keep nav items aligned*/ #navigation { height: 40px; background: #52bf6e; border-radius: 10px; border: 1px solid #3ea858; margin: 5px; display: flex; justify-content: center } #contentwrap { width: 700px; float: left; margin: 0 auto; } #content { background: #FFFFFF; border-radius: 10px; margin: 5px; } #leftcolumnwrap { width: 150px; float: left; margin: 0 auto; } #leftcolumn { border-radius: 10px; margin: 5px; } #rightcolumnwrap { width: 150px; float: left; margin: 0 auto; } #rightcolumn { border-radius: 10px; margin: 5px; } #footerwrap { width: 1000px; float: left; margin: 0 auto; clear: both; } #footer { height: 40px; background: #9D9FA4; border-radius: 10px; border: 1px solid #888a91; margin: 5px; background-color: #9D9FA4; text-align: center; color: #FFFFFF; font-weight: bold; } #navigationwrap_placeholder { display: none; height: 40px; } <html> <head> <meta charset="utf-8"> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> </head> <body> <div id="wrapper"> <div id="headerwrap"> <div id="header"> </div> </div> <div id="navigationwrap"> <div id="navigation"> <ul> <li>main menu</li> <li><a>test</a> <ul class="sub-menu"> <li>test1</li> <li>test2</li> <li>test3</li> <li>test4</li> </ul> </li> </ul> </div> </div> <div id="navigationwrap_placeholder"></div> <div id="leftcolumnwrap"> <div id="leftcolumn"> <p></p> </div> </div> <div id="contentwrap"> <div id="content"> <br> <br> <p>Sed lacinia, urna non tincidunt mattis, tortor neque adipiscing diam, a cursus ipsum ante quis turpis. Nulla facilisi. Ut fringilla. Suspendisse potenti. Nunc feugiat mi a tellus consequat imperdiet. Vestibulum sapien. Proin quam. Etiam ultrices. Suspendisse in justo eu magna luctus suscipit. Sed lectus. Integer euismod lacus luctus magna. Quisque cursus, metus vitae pharetra auctor, sem massa mattis sem, at interdum magna augue eget diam. Vestibulum ante ipsum primis in faucibus orci luctus et ultrices posuere cubilia Curae; Morbi lacinia molestie dui. Praesent blandit dolor. </p> <br> <br> </div> </div> <div id="rightcolumnwrap"> <div id="rightcolumn"> <p></p> </div> </div> <div id="footerwrap"> <div id="footer"> </div> </div> </div> </body> </html>
Restyling an unordered list using pseudo elements
I am trying to create a custom list using pseudo elements in CSS. When I add this "position: absolute; top: 6px; left: 0px;", my images for my arrows disappear altogether. When I remove the above line of code, my arrow images appear above the text each list item. I want my custom arrows to appear next to the next of each list item. How can I fix this? Here is my code. <!DOCTYPE HTML> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>My Web Page</title> <style type="text/css"> body { font-family: Arial; font-size: 16px; background-color: #f8e6ae; color: #888; } .page { background-color: #fff; padding: 20px 30px 30px 50px; margin: 100px; } .page h1 { color: #fff; font-size: 1.3em; font-weight: normal; text-transform: uppercase; background-color: #d60000; position: relative; margin: 0px -70px 20px -50px; padding: 18px 0px 16px 50px; } .page h1:after { content: ''; display: block; height: 40px; width: 40px; background: url(images/fold.gif) no-repeat 0 0; position: absolute; right: 0px; bottom: -40px; } .page p { line-height: 1.2em; } .page a { color: #1badd2; text-decoration: none; } .page ul { margin: 0; padding:0; } .page li { display: block; position: relative; padding: 2px 0px 8px 35px; } .page li:before { content: ''; display: block; background: url(images/arrow.png) no-repeat 0 0; height: 12px; width 30px; position: absolute; top: 6px; left: 0px; background-size: 20px 8px; } </style> </head> <body> <div class="page"> <h1>My Web Page</h1> <p>Lorem ipsum dolor sit amet consectetur adi pisicing elit sed do eiusmod tempor incid idunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exer citation ull amco laboris nisi ut aliquip ex ea commodo consequat elit sed do.</p> <ul> <li>Automating Web Graphics</li> <li>Slice Tool</li> <li>Smart Objects</li> <li>Layer Comps</li> </ul> </div> </body> </html> .
I was missing a colon for the width property in the preceding line of code.