css - Centering background of centered menu to page -


i having confusion sorting out how gain 100% centering elements.

i trying have grey background larger width centered horizontal menu.i want grey background reach top of page bottom of page. while testing code change way menu aligned , not center menu both screen/page , background.

i have edited code give better visualization of issues (4th edit)

html {    background-color: rgba(255, 216, 0, 0.4);  }  {    float: left;    width: 8em;    text-decoration: none;    color: white;    background-color: #0094ff;    padding: 0.2em 0.4em;    border-right: 1px solid white;  }  a:hover {    background-color: #b6ff00;  }  li {    display: inline;    background-color: #ff0000;  }  div {    -webkit-touch-callout: none;    -webkit-user-select: none;    -khtml-user-select: none;    -moz-user-select: none;    -ms-user-select: none;    user-select: none;  }  .table {    position: relative;    margin: auto;    width: 50%;  }  #horizontal-list {    background-color: #808080;    padding: 5em;    height: auto;    width: 75%;  }  body {    margin: 0;    padding: 0;  }
<!doctype html>  <html xmlns="http://www.w3.org/1999/xhtml">    <head>    <link rel="stylesheet" type="text/css" href="sitestyles.css">    <title>blahblah</title>  </head>    <body>    <div id="container">      <div class="table">        <div class="menubg">          <ul id="horizontal-list">            <li>              <a href="#">                <img src="image.png" onmousedown="return false;" alt="something" />              </a>            </li>            <li>              <a href="#">                <img src="image.png" onmousedown="return false;" alt="something" />              </a>            </li>            <li>              <a href="#">                <img src="image.png" onmousedown="return false;" alt="something" />              </a>            </li>            <li>              <a href="#">                <img src="image.png" onmousedown="return false;" alt="something" />              </a>            </li>            <li>              <a href="#">                <img src="image.png" onmousedown="return false;" alt="something" />              </a>            </li>          </ul>        </div>      </div>    </div>    </body>    </html>

add code in order avoid gap in top margin:

body {  margin:0; padding:0;  } 

Comments

Popular posts from this blog

asp.net mvc - SSO between MVCForum and Umbraco7 -

Python Tkinter keyboard using bind -

ubuntu - Selenium Node Not Connecting to Hub, Not Opening Port -