<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <link rel="stylesheet" href="layout.css"> <title>Document</title> </head> <body> <header> <h1 class="headline"> <a href="">Sample</a> </h1> <ul class="nav-list"> <li class="nav-list-item"><a href="">Home</a></li> <li class="nav-list-item"><a href="">About</a></li> <li class="nav-list-item"><a href="">Topic</a></li> </ul> </header> <footer> <ul class="footer-menu"> <li>home |</li> <li>about |</li> <li>service |</li> <li>Contact Us</li> </ul> <p>© All rights reserved by Sample</p> </footer> </body> </html>
* { margin:0; padding:0; } header { height: 100px; width: 100%; padding: 15px 0; background-color: #337079; color: white; } header .headline { line-height: 100px; float: left; font-size: 30px; margin-left: 100px; } .nav-list { line-height: 100px; float: left; margin-left: 30px; list-style:none; } .nav-list-item { list-style: none; display: inline-block; margin: 0 20px; } footer { width: 100%; height: 100px; background-color: #cab64a; color: #fff; text-align: center; } ul.footer-menu li { display: inline; }
.wrapper { min-height: 100vh; position:relative; padding-bottom: 120px; box-sizing: border-box; } footer { width: 100%; height: 100px; background-color: #cab64a; color: #fff; text-align: center; position: absolute; bottom:0; }
意外とするできる。