CSS rail in the left and right end of a website -


i beginner in web developing , tried create simple website. know how can place gray rails in left , right end of website? here layout:

my layout

enter image description here

i tried create 2 divs , place them float, dont work me.

thanks help

these 2 grey divs background. therefore don't need take care of them. instead you'll have work on header (top portion) , footer (lower portion) main body (white centered div).

you need careful position property, , set height: 100% both html , body. other it's basic css.

html {    height: 100%;  }    body {    height: 100%;    margin: 0px;    padding: 0px;    min-height: 100%;    background: grey;    position: relative;  }    #header {    height: 100px;    width: 100%;    top: 0px;    left: 0px;    background: orange;    position: fixed;  }    #footer {    height: 50px;    width: 100%;    bottom: 0px;    left: 0px;    background: orange;    position: fixed;  }    #content {    -webkit-box-sizing: border-box;    -moz-box-sizing: border-box;    box-sizing: border-box;    height: 100%;    width: 50%;    margin: auto;    background-color: white;  }
<body>    <div id="header"></div>    <div id="content"></div>    <div id="footer"></div>  </body>

better here on codepen


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -