html - Why is my footer at the top of my page? -
firstly, used
#copyright { position: fixed; bottom: 0; left: 0; right: 0; height: 50px } footer { position: fixed; bottom: 50px; left: 0; right: 0; }
which worked fine until tested site on smaller screen , realised footers overlapping content. tried setting html
, body
height 100%
, setting wrapper
min height 100%
, placing footer underneath, in hopes of more relative footer. stuck @ top, causing ?
#wrapper { display: block; position: fixed; text-align: center; min-height: 100%; width: 100%; top: 0; bottom: 0; left: 0; right: 0; } #header p { font-size: 2em; margin: 0; } #header ul { list-style-type: none; } #header ul li { display: inline; padding: 20px 20px; font-size: 1.5em; margin: 0 30px; } #copyright { position: relative; height: 50px; width: 100%; text-align: center; font-size: 0.8em; } #footer { position: relative; margin-top: 15px; height: 50px; width: 100%; text-align: center; font-size: 0.8em; } #footer ul { list-style-type: none; } #footer ul li { display: inline; margin: 0 15px; }
<div id="wrapper"> <div id="header"> <p>pavel design</p> <ul> <li><a href="index.html">home</a></li> <li><a href="about.html">about</a></li> <li><a href="gallery.html">gallery</a></li> <li><a href="services.html">services</a></li> <li><a href="contact.html">contact</a></li> </ul> </div> <div id="contentwrapper"> <div id="content"> <h1>lorem ipsum</h1> <p>lorem ipsum dolor sit amet, consectetur adipiscing elit. nam tempus imperdiet nulla scelerisque bibendum. praesent eu tempus dolor, vel venenatis purus.</p> </div> </div> </div> <footer id="footer"> <ul> <li><a href="index.html">home</a></li> <li><a href="about.html">about</a></li> <li><a href="gallery.html">gallery</a></li> <li><a href="services.html">services</a></li> <li><a href="contact.html">contact</a></li> <li><a href="mailto:info@pavel.co.nz">info@pavel.co.nz</a></li> </ul> <p>© pavel design 2016 | photography, design , website construction pavel design 2016</p> </footer>
edit:
my wrapper uses fixed position can assign top: 0
bottom: 0
, on, because use background image covers whole screen, when use min-height
, min-width
background image doesn't cover whole screen, instead leaves small white border around outside of page
you don't need give 2 footers , don't need give id="footer"
html5 provided tag, try if works you
check demo here fiddle
html
<div id="wrapper"> <div id="header"> <p>pavel design</p> <ul> <li><a href="index.html">home</a></li> <li><a href="about.html">about</a></li> <li><a href="gallery.html">gallery</a></li> <li><a href="services.html">services</a></li> <li><a href="contact.html">contact</a></li> </ul> </div> <div id="contentwrapper"> <div id="content"> <h1>lorem ipsum</h1> <p>lorem ipsum dolor sit amet, consectetur adipiscing elit. nam tempus imperdiet nulla scelerisque bibendum. praesent eu tempus dolor, vel venenatis purus.</p> </div> </div> </div> <footer> <ul> <li><a href="index.html">home</a></li> <li><a href="about.html">about</a></li> <li><a href="gallery.html">gallery</a></li> <li><a href="services.html">services</a></li> <li><a href="contact.html">contact</a></li> <li><a href="mailto:info@pavel.co.nz">info@pavel.co.nz</a></li> </ul> <p>© pavel design 2016 | photography, design , website construction pavel design 2016</p> </footer>
css
#wrapper { display: block; position: fixed; text-align: center; min-height: 100%; width: 100%; top: 0; bottom: 0; left: 0; right: 0; } #header p { font-size: 2em; margin: 0; } #header ul { list-style-type: none; } #header ul li { display: inline; padding: 20px 20px; font-size: 1.5em; margin: 0 30px; } footer { position: fixed; margin-top: 2%; height: 50 width: 100%; text-align: center; font-size: 0.8em; bottom: 0; } footer ul { list-style-type: none; } footer ul li { display: inline; margin: 0 15px; }
Comments
Post a Comment