Make footer disappear behind body and appear when scrolling down - html

I would like the footer of my website to stay behind the body until I start scrolling down or I hit the end of the page.
Means: when I start scrolling the footer should start appearing the more I scroll and if there is enough content than the footer should only appear once I get to the bottom of the page.
Here is what I did till now: https://jsfiddle.net/rq1gevb9/1/
I tried several tutorials, but I'm stuck with the footer on top and not under nor below the body.
Edit: CSS for the page
/* BODY */
body {
font-family: Consolas;
color: white;
background-color: #151515;
margin-left: 12%;
margin-right: 12%;
z-index: 2;
margin-bottom: 20px;
box-shadow: 100px -100px -100px -100px black;
}
/* HEADER */
header {
padding: 20px;
text-align: center;
}
header h1 {
margin: 0;
}
header h1 a {
color: whitesmoke;
}
header nav {
margin-top: 10px;
}
header nav ul {
list-style-type: none;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
}
header nav ul li {
margin: 0 10px;
}
header nav ul li a {
text-decoration: none;
color: white;
}
header nav a:hover {
font-weight: 700;
text-decoration: underline;
}
/* SECTIONS GLOBALS */
section {
padding: 20px;
}
section h2 {
margin-top: 0;
}
/* SECTIONS LOCALS */
/* SECTIONS Homepage */
section#hp-projects ul {
list-style-type: none;
margin: 0;
padding: 0;
}
section#hp-projects ul li {
margin-bottom: 10px;
}
section#hp-projects ul li a {
text-decoration: none;
color: white;
}
section#hp-projects ul li a:hover {
font-weight: 700;
text-decoration: underline;
}
/* SECTIONS About */
section#about-badges div img {
height: 30px;
}
.column {
display: inline-block;
}
/* FOOTER */
footer {
width: 100%;
position: fixed;
left: 0;
bottom: 0;
z-index: -1;
text-align: center;
background-color: whitesmoke;
}

First fix some errors in HTML.
Footer /footer element must be inside /body closing tag
/body must be just before /html.
Then wrap all the content inside a div (class .container) excluding /footer /footer.
Write some CSS to syle the background color, width all the viewport and margin left to puti at the beginning of the screen. Give it a margin bottom space to reveal the footer behind after scrolling.
.container {
background-color: #000;
width: 100vw;
margin-left: calc(-1*(50vw - 50%));
margin-bottom: 150px;
}
Here the full HTML code
<div class="container">
<header>
<h1 style="display: inline-block;">Projet NSI - Site Web</h1>
<nav>
<ul>
<li>About</li>
<li>Projects</li>
</ul>
</nav>
</header>
<section id="hp-about">
<h2>About Me</h2>
<p>I am a web developer with no experience in HTML, CSS, and JavaScript. I am passionate about creating user-friendly and visually appealing websites.</p>
</section>
<section id="hp-projects">
<h2>My Projects</h2>
<ul>
<li>Project 1</li>
<li>Project 2</li>
<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />
<li>Project 3</li>
</ul>
</section>
</div>
<!-- container closed - footer excluded -->
<footer>
Footer!
<br />
Hi
<br />
Hi
<br />
Hi
<br />
Hi
<br />
Hi
<br />
Hi
<br />
Hi
</footer>
Here the full CSS code
/* BODY */
body {
font-family: Consolas;
color: white;
background-color: #151515;
margin-left: 12%;
margin-right: 12%;
z-index: 2;
margin-bottom: 20px;
box-shadow: 100px -100px -100px -100px black;
}
.container {
background-color: #000;
width: 100vw;
margin-left: calc(-1*(50vw - 50%));
margin-bottom: 150px;
}
/* HEADER */
header {
padding: 20px;
text-align: center;
}
header h1 {
margin: 0;
}
header h1 a {
color: whitesmoke;
}
header nav {
margin-top: 10px;
}
header nav ul {
list-style-type: none;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
}
header nav ul li {
margin: 0 10px;
}
header nav ul li a {
text-decoration: none;
color: white;
}
header nav a:hover {
font-weight: 700;
text-decoration: underline;
}
/* SECTIONS GLOBALS */
section {
padding: 20px;
}
section h2 {
margin-top: 0;
}
/* SECTIONS LOCALS */
/* SECTIONS Homepage */
section#hp-projects ul {
list-style-type: none;
margin: 0;
padding: 0;
}
section#hp-projects ul li {
margin-bottom: 10px;
}
section#hp-projects ul li a {
text-decoration: none;
color: white;
}
section#hp-projects ul li a:hover {
font-weight: 700;
text-decoration: underline;
}
/* SECTIONS About */
section#about-badges div img {
height: 30px;
}
.column {
display: inline-block;
}
/* FOOTER */
footer {
width: 100%;
position: fixed;
left: 0;
bottom: 0;
z-index: -1;
text-align: center;
background-color: #FFF;
color: #000;
}
Here the working codepen example
https://codepen.io/Davevvave/pen/VwBzYNa

You can use the min-height property to make your main content be at least the full screen height with 100vh. Here is an example:
<body>
<main>
<nav>Some Links</nav>
<section>Some Content</section>
</main>
<footer>Footer goes here</footer>
</body>
and in your styles:
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}
main {
min-height: 100vh;
width: 100%;
background: blue;
}
footer {
height: 200px;
width: 100%;
background: red;
}
Herer is the example fiddle: https://jsfiddle.net/qh4c8b5m/4/

Related

Form is not showing in tabs

I'm having trouble displaying the form, in the div tabs. Any quick solution without changing a whole lot of code or using javascript?
I'm quite new, and have used a tutorial of youtube to create the responsive tabs using only css and html. Please ignore the nav bar as i will be fixining, just the tabs and forms.
nav {
list-style-type: none;
font-family: sans-serif;
margin: 0;
padding: 0;
width: 20%;
background-color: #3C3939;
height: 100%;
/*full height */
position: fixed;
/* Make it stick, even on scroll */
overflow: auto;
/* enable scrolling if the sidenav has too much content */
}
li a {
display: block;
/* links as block elements, whole link area click */
color: #000;
padding: 8px 1px;
/*padding between pages*/
padding-top: 20px;
text-decoration: none;
text-align: center;
}
ul {
list-style-type: none;
}
/* change link color on hover */
li a:hover {
background-color: #555;
color: #F3ECEC;
}
.title {
text-align: center;
color: #3C3939;
background-color: #3C3939;
}
.title1 {
text-align: center;
color: #572222;
background-color: #3C3939;
padding-top: 20px;
}
/* NAV ENDS */
/* TABS STRS */
* {
box-sizing: border-box;
}
body {
margin: 0;
padding: 0;
font-family: arial;
font-size: 16px;
line-height: 1.6
}
.container {
max-width: 452px;
margin: 50px auto;
position: relative;
left: 20%;
bottom: 10%;
}
.tab_trigger {}
.tab_trigger ul {
margin: 0;
padding: 0;
list-style: none;
display: flex;
}
.tab_trigger ul li {
width: 50%;
}
.tab_trigger ul li label {
position: relative;
display: block;
padding: 8px 15px;
cursor: pointer;
min-width: 100px;
text-align: center;
font-weight: 700;
text-transform: uppercase;
border-radius: 8px 8px 0 0;
}
.tab_trigger ul li:nth-child(1) label {
background: rgb(90, 72, 72);
}
.tab_trigger ul li:nth-child(2) label {
background: rgb(90, 72, 72);
}
.tab_container_wrap {
overflow-y: scroll;
overflow-x: hidden;
height: 590px;
}
.tab_container_wrap input {
position: absolute;
width: 0;
height: 0;
margin: 0;
z-index: -100;
top: -10000px;
}
.tab_container_wrap input:checked+.tab_content_box {
display: block;
}
.tab_container_wrap :-ms-input-placeholder:checked+.tab_content_box {
display: block;
}
/* CONTENT BOX SWITCH*/
.tab_content_box {
background: yellow;
padding: 20px;
height: 590px;
}
.tab_content_box h2 {
margin: 0 0 20px
}
.tab_content_box:nth-of-type(1) {
background: #3C3939;
display: none;
}
.tab_content_box:nth-of-type(2) {
background: #3C3939;
overflow: visible;
}
/* END CONTENT BOX SWITCH */
/* END TABS */
/* STYLING SCRUMS STRT */
.scrums2 {
position: absolute;
left: 100px;
}
<!DOCTYPE html>
<html>
<head>
<title>Organize</title>
<link rel="stylesheet" href="Home.css" hreflang="test.py" type="text/css">
</head>
<body>
<nav>
<ul>
<li>
<div class="title">
<h1>Organize</h1>
</div>
</li>
<li>Folders</li>
<li>Timeline</li>
<li>Pages</li>
<li>Meetings</li>
<li>
<div class="title1">
<h3>documents</h3>
</div>
</li>
<li></li>
</ul>
</nav>
<!-- TABS -->
<div class="container">
<div class="tab_trigger">
<ul>
<li><label for="tab1">Messages</label></li>
<li><label for="tab2">scrums</label></li>
</ul>
</div>
<div class="tab_container_wrap">
<input type="radio" checked id="tab1" name="1">
<!-- MESSAGES -->
<div class="tab_content_box">
<h2>Messages</h2>
<p>YOU KNOW WHAT</p>
</div>
<!-- MESSAGES END -->
<input type="radio" checked id="tab2" name="1">
<!-- SCRUMS -->
<div class="tab_content_box">
<h2>Scrums</h2>
<p>hi</p>
<div class="scrums2">
<div class="form">
<p>hi</p>
<ul>
<p>hi</p>
<li>hi<input type="text" id="a" name="a" placeholder="What did you do today?"></li>
<li><input type="text" id="b" name="b" placeholder="Obstacles faced?"></li>
<li><input type="text" id="c" name="c" placeholder="What did you do yesterday?"></li>
</ul>
</div>
</div>
</div>
<!-- SCRUMSEND -->
<!-- TABSEND -->
</div>
</div>
</body>
</html>
Fixed :) any future people answer :
.tab_container_wrap input{} needed an input type by doing .tab_container_wrap input[type=radio]
otherwise, input elements that are in the div container will be hidden.
Here is a sample code of the answer.
.tab_container_wrap input[type="radio"]{
position:absolute;
width:0;
height:0;
margin:0;
z-index: -100;
top: -10000px;
}
.tab_container_wrap input:checked + .tab_content_box{
display: block;
}
.tab_content_box:nth-of-type(1){
background:#3C3939;
display: none;
}
.tab_content_box:nth-of-type(2){
background: #3C3939;
display: none;
}

Why is the content rendered under the navigation menu?

There is a navigation menu that I developed in <header>. However, the <p> element I use after the <header> element and the <header> components overlap. Why does this issue occur and how do I fix this issue?
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: cabin, sans-serif;
}
header {
display: block;
}
.primary {
color: blue;
font-weight: bold;
}
.navbar {
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
height: 70px;
position: fixed;
top:0px;
padding: 0 30px;
background: transparent;
}
.navbar ul {
display: flex;
}
.navbar li {
list-style: none;
}
.navbar a {
text-decoration: none;
margin: 0 5px;
padding: 10px 20px;
font-weight: bolder;
}
.navbar a:hover{
border-bottom: 2px blue solid;
}
.navbar a:visited{
color: blue;
}
<body>
<!-- Navigation Menu -->
<header>
<div class="navbar">
<h1 class="logo"><span class="primary">benj</span>.codes</h1>
<ul>
<li>Home</li>
<li>About</li>
<li>Projects</li>
<li>Contact</li>
</ul>
</div>
</header>
<!-- Content -->
<p>test</p>
</body>
This issue occurs in the .navbar class style position: fixed; caused by its use. In this case, the navigation menu remains fixed when the scrollbar is opened. So you can enclose other elements after the <header> element in a <div> element; apply a margin-top style to this element and you will see all other content scroll.
* {
box-sizing: border-box;
margin: 0;
padding: 0;
}
body {
font-family: cabin, sans-serif;
}
header {
display: block;
}
.primary {
color: blue;
font-weight: bold;
}
.navbar {
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
height: 70px;
/* This style applied causes the <p> element to render above. */
position: fixed;
top:0px;
padding: 0 30px;
background: yellow;
}
.navbar ul {
display: flex;
}
.navbar li {
list-style: none;
}
.navbar a {
text-decoration: none;
margin: 0 5px;
padding: 10px 20px;
font-weight: bolder;
}
.navbar a:hover{
border-bottom: 2px blue solid;
}
.navbar a:visited{
color: blue;
}
/* The following style has been applied to the <div> element that encloses other elements. */
.container {
margin-top: 70px; /* To avoid shifting caused by the "position: fixed" class style */
height: 1500px; /* To make the scrollbar pop up */
}
p {
height: 200px;
border: 1px solid red;
background-color: lightgray;
}
<body>
<header>
<div class="navbar">
<h1 class="logo"><span class="primary">benj</span>.codes</h1>
<ul>
<li>Home</li>
<li>About</li>
<li>Projects</li>
<li>Contact</li>
</ul>
</div>
</header>
<div class="container">
<p>Content</p>
</div>
</body>

Align object to the bottom of a header

I have successfully stored a PDF object on the resume section of this website I am working on. However, I am trying to align the top of the Object (which in this case is the PDF viewer) with the bottom of the header (which is represented by a gray line in the upcoming screenshot). I keep getting whitespace in between the top of the Object and the bottom of the header, as evidenced in this screenshot.
Here is the HTML of the body section in question:
<body>
<header>
<a href="index.html" id="logo"> <h1>
<div id="header_title">
Title
</div></h1> </a>
<div id="header_border"></div>
<nav id="nav">
<ul>
<li>
<a href="index.html" class="selected" >About</a>
</li>
<li>
Resume
</li>
<li class="subNav">
<a>Portfolio</a>
<ul>
<li>
Writing Samples
</li>
<li>
Photoshop
</li>
</ul>
</li>
<li>
Contact
</li>
</ul>
</nav>
</header>
<object id="resume" data="img/Resume.pdf" type="application/pdf" style="float: left" width="100%" height="100%">
<p>
It appears you don't have a PDF plugin for this browser.
No biggie... you can <a href="myfile.pdf">click here to
download the PDF file.</a>
</p>
</object>
</body>
And CSS:
html {
height: 100%;
}
body {
font-family: 'Playfair Display', open sans;
height: 100%;
}
#wrapper {
max-width: 940px;
margin: 0 auto;
padding: 0 5%;
}
a {
text-decoration: none;
}
img {
max-width: 100%; /* images fill width of parent container
image will shrink with size of container */
}
h3 {
margin: 0 0 1em 0;
}
/************************
HEADING
*************************/
header {
position: relative;
float: left;
margin: 0 0 30px 0; /* top, right, bottom, left */
padding: 5px 0 0 0; /* ibid */
width: 100%; /* since floated, this element does not have an
explicit width; therefore, it must be assigned to 100%
of page*/
}
#logo {
text-align: center;
margin: 0;
}
h1 {
font-family: 'Playfair Display', open sans;
/* font-size: 100px; font-size is overruled in responsive.css
for computer screens set in min-width 660*/
margin: 85px 0;
font-weight: normal;
/* font-weight: normal; will unbold the headline, as headlines
are set to bold by default. */
line-height: 0.8em;
}
#header_title {
position: absolute;
bottom: 0;
left: 50px;
padding: 10px 0;
}
#header_border {
width: calc(95% - 70px);
position: absolute;
bottom: 0;
margin-left: 50px;
border-bottom: 2px solid #dddede;
}
/************************
NAVIGATION
*************************/
nav {
position: absolute;
bottom: 0;
right: 0;
padding: 10px 0;
}
nav ul {
list-style: none;
margin: 0 10px;
padding: 0;
}
nav > ul > li { /* only impacts the first list items; keeps About, Portfolio, Contacts in horizontal line*/
display: inline-block;
position: relative;
}
nav > ul> li> a {
font-weight: 800;
padding: 15px 10px;
}
nav > ul > li.subNav ul > li> a {
}
nav > ul > li.subNav ul { /* now free to style/block secondary list*/
display: none;
position: absolute;
top: 100%;
left: 0;
white-space: nowrap;
background: pink;
}
nav ul li.subNav:hover ul {
display: block;
text-align: left;
}
/***********************
* BODY
*/
#resume {
height: 100%;
width: 100%;
}
Your header styles have a margin of 30px on the bottom. Remove this and the object will line up with the bottom of your header.
margin: 0 0 30px 0; /* top, right, bottom, left */
should be
margin: 0;

linearly curved header at the bottom?

Sorry for repeating this question similar to SO here: Can I create a div with a Curved bottom?
But method there does not fulfill my customization need of header.
But what i want to achieve is not quite similar to what i've achieve with the border border-bottom-left-radius and border-bottom-right-radius.
As you can see the images that header i want to achieve is linearly curved throughout the bottom but with what i've achieved is that i'm having more curvy border at the left and right portion of header and curved is not linear throughout the bottom. It becomes straight after short distance. I've tried to increase the %age but it becomes even more curved at edges.
Is there any other way of doing this so that i get linearly curved throughout the bottom?
Here is my code:
CSS Code:
header{
background-color: #000;
border-bottom-left-radius:25%;
border-bottom-right-radius:25%;
padding: 10px;
opacity: 0.35;
position: fixed;
width: 100%;
z-index: 1000;
}
Here is the link JSfiddle link: https://jsfiddle.net/ozqneuha/
#import url(https://fonts.googleapis.com/css?family=Open+Sans:400,600,700);
/* --Global CSS-- */
.header-container {
margin: 0 auto;
width: 1170px;
}
ul {
padding: 0;
margin: 0;
}
/* Header CSS*/
header {
background-color: #000;
border-bottom-left-radius: 25%;
border-bottom-right-radius: 25%;
padding: 10px;
opacity: 0.35;
position: fixed;
width: 100%;
z-index: 1000;
}
header nav ul {
list-style-type: none;
}
header .logo {
display: inline-block;
}
header .header-nav {
display: inline-block;
float: right;
padding: 7px;
}
header li {
float: left;
margin-left: 20px;
}
header li a {
color: #fff;
font: 600 16px'Open Sans';
text-transform: uppercase;
text-decoration: none;
}
header li a:hover,
header li a:active {
color: #e51937;
text-decoration: none;
}
<header>
<div class="header-container">
<div class="logo">
<a href="#">
<img src="http://i.imgur.com/2JbjOqY.png" alt="logo">
</a>
</div>
<div class="header-nav">
<nav>
<ul>
<li>Search
</li>
<li>Map
</li>
<li>Properties
</li>
<li>Parking
</li>
<li>Residents
</li>
<li>Pay Online
</li>
</ul>
</nav>
</div>
<!-- /.header-nav -->
</div>
<!-- /.header-container -->
</header>
You could give clip-path a try, but make sure to check browser support.
Can I use CSS clip-path property
You basically just use an ellipse to clip your header div.
#import url(https://fonts.googleapis.com/css?family=Open+Sans:400,600,700);
body {
margin: 0;
}
/* --Global CSS-- */
.header-container{
margin: 0 auto;
width: 1170px;
text-align: right;
}
ul{
padding: 0;
margin:0;
}
/* Header CSS*/
header{
background-color: #000;
/*
border-bottom-left-radius:25%;
border-bottom-right-radius:25%;
*/
padding: 10px;
opacity: 0.35;
position: fixed;
width: 100%;
z-index: 1000;
min-height: 50px;
-webkit-clip-path: ellipse(60% 100% at 50% 0%);
clip-path: ellipse(60% 100% at 50% 0%);
}
header nav ul{
list-style-type: none;
}
header .logo {
display: inline-block;
float: left;
}
header .header-nav{
display: inline-block;
/*float: right;*/
padding: 7px;
}
header li{
float: left;
margin-left: 20px;
}
header li a{
color: #fff;
font: 600 16px 'Open Sans';
text-transform: uppercase;
text-decoration: none;
}
header li a:hover,
header li a:active{
color: #e51937;
text-decoration: none;
}
#media screen and (max-width: 1169px) {
.header-container {
width: 840px;
}
header .header-nav{
display: inline-block;
}
}
#media screen and (max-width: 996px) {
.header-container {
width: 100%;
}
header .logo {
float: none;
display: block;
text-align: center;
}
header .header-nav{
display: none;
}
}
<header>
<div class="header-container">
<div class="logo">
<a href="#">
<img src="http://i.imgur.com/2JbjOqY.png" alt="logo" />
</a>
</div>
<div class="header-nav">
<nav>
<ul>
<li>Search</li>
<li>Map</li>
<li>Properties</li>
<li>Parking</li>
<li>Residents</li>
<li>Pay Online</li>
</ul>
</nav>
</div><!-- /.header-nav -->
</div><!-- /.header-container -->
</header>
Can you try this way?
#import url(https://fonts.googleapis.com/css?family=Open+Sans:400,600,700);
/* --Global CSS-- */
.header-container {
margin: 0 auto;
width: 1170px;
}
ul {
padding: 0;
margin: 0;
}
/* Header CSS*/
header {
background-color: #000;
border-bottom-left-radius: 50%;
border-bottom-right-radius: 50%;
padding: 10px 10px 35px;
opacity: 0.35;
position: fixed;
width: 100%;
z-index: 1000;
}
header nav ul {
list-style-type: none;
}
header .logo {
display: inline-block;
}
header .header-nav {
display: inline-block;
float: right;
padding: 7px;
}
header li {
float: left;
margin-left: 20px;
}
header li a {
color: #fff;
font: 600 16px'Open Sans';
text-transform: uppercase;
text-decoration: none;
}
header li a:hover,
header li a:active {
color: #e51937;
text-decoration: none;
}
<header>
<div class="header-container">
<div class="logo">
<a href="#">
<img src="http://i.imgur.com/2JbjOqY.png" alt="logo">
</a>
</div>
<div class="header-nav">
<nav>
<ul>
<li>Search
</li>
<li>Map
</li>
<li>Properties
</li>
<li>Parking
</li>
<li>Residents
</li>
<li>Pay Online
</li>
</ul>
</nav>
</div>
<!-- /.header-nav -->
</div>
<!-- /.header-container -->
</header>
This is how I did it:
.overlay {
position: absolute;
z-index: -1;
height: 100%;
border-radius: 50%;
width: 150%;
left: -25%;
top: -60%;
background: rgba(121, 121, 121, 0.8);
pointer-events:none;
}
Here is the JSFiddle demo
Adjust the width, left and top percentage to your liking :)
I've finally figured out out the solution of this problem. I've used pesudo class :before for the solution.
/* --Global CSS-- */
.header-container {
display: table;
margin: 0 auto;
width: 1170px;
height: 100%;
}
ul {
padding: 0;
margin: 0;
}
/* Header CSS*/
header {
padding: 10px;
position: fixed;
width: 100%;
z-index: 1000;
}
header:before {
background-color: rgba(0, 0, 0, 0.35);
width: 150%;
content: '';
height: 150px;
border-bottom-left-radius: 50%;
border-bottom-right-radius: 50%;
top: -76px;
position: absolute;
z-index: -1;
margin-left: -25%;
}
header ul {
list-style-type: none;
}
header .logo {
display: table-cell;
vertical-align: middle;
}
header .header-nav {
display: table-cell;
float: right;
padding: 7px;
vertical-align: middle;
}
header li {
display: inline-block;
}
header li a {
color: #fff;
font: 600 16px'Open Sans';
padding: 0 15px 0 15px;
text-transform: uppercase;
text-decoration: none;
transition: all 0.3s;
}
header li a:hover,
header li a:active {
color: #e51937;
text-decoration: none;
}
<header>
<div class="header-container">
<div class="logo">
<a href="#">
<img src="http://i.imgur.com/2JbjOqY.png" alt="logo">
</a>
</div>
<div class="header-nav">
<nav>
<ul>
<li>Search
</li>
<li>Map
</li>
<li>Properties
</li>
<li>Parking
</li>
<li>Residents
</li>
<li>Pay Online
</li>
</ul>
</nav>
</div>
<!-- /.header-nav -->
</div>
<!-- /.header-container -->
</header>

How do you make a make a page's worth of empty space (with only a title) followed by a div in CSS?

I have a webpage I have been working on and I want to have a static background. The idea is to have the page initially only show a title and the background and have you scroll down for content (a div that fills up the entire width of the browser and has a filled background). The page has a navbar at the top that already spans the entire width of the screen. My question is, how to you make this possible? Here is the code I tried, which didn't quite do the trick. I have nothing for the CSS in main.
HTML:
<body>
<div class="wrapper">
<div class="navbar">
<ul>
<li>Link 1</li>
<li>Link 2</li>
<li>Link 3</li>
</ul>
</div>
<div class="topspace">
<h1 class="mainTitle">Title</h1>
</div>
<div class="main">
Bottom content<br /><br /><br /><br /><br /><br />
</div>
</div>
</body>
CSS:
body {
font-family: sans-serif;
margin: 0;
border: 0;
padding: 0;
}
.navbar {
background-color: #708090;
margin: 0 0 auto;
border: 0;
padding: 0;
}
.navbar ul {
display: inline-block;
list-style: none;
margin: 0;
padding: 0;
}
.navbar ul li {
display: inline-block;
margin: 0;
padding: 0;
}
.navbar ul li a {
text-decoration: none;
color: #DDD;
display: block;
padding: 5px 10px;
border: 0;
}
.navbar ul li a:hover {
color: #FFF;
background-color: #222;
}
.topspace {
position: absolute;
top: 40px;
bottom: 0px;
right: 0px;
left: 0px;
}
.mainTitle {
margin-left: auto;
margin-right: auto;
padding-top: 40%;
color: #B22222;
}
.wrapper {
border:0;
margin: 0;
padding:0;
background: rgba(0, 100, 100, 0.6);
}
Here is a JSFiddle for this code, though it is not displayed quite as it looks on my browser http://jsfiddle.net/xpkayL9t/
use the background cover
just look at this
http://css-tricks.com/perfect-full-page-background-image/