3

Here is my website: http://sousvi.zymichost.com.

I have a list-styled menu (Home, Participation, Competition, etc.) and am trying to center it across the page so that it displays correctly on desktop computers and mobile devices (iPhone, iPad). I have adjusted the width of the menu div to the exact pixel amount of the menu itself. It appears fine on the computer, but not on the iPad or iPhone. I don't want to create a mobile website, I just want to center the menu across the page. Here is the HTML and CSS below.

<div id="navigation">
        <div id='cssmenu'>
            <ul>
                <li class='active'><a href='../index.html'><span>Home</span></a></li>
                <li><a href='../participation.html'><span>Participation</span></a></li>
                <li><a href='../competition.html'><span>Competition</span></a></li>
                <li><a href='../affiliations.html'><span>Affiliations</span></a></li>
                <li class='last'><a href='../contact.html'><span>Contact</span></a></li>
            </ul>
        </div>
    </div>

body {
    background: url(img/red.png) top center no-repeat;
    background-color: #ececec;
    margin: 0;
    font-family: SpecialOlympics;
}

@font-face {
    font-family: SpecialOlympics;
    src: url('font/Ubuntu-R.ttf');
}

#wrapper {
    background-color: #CCC;
    width: 1000px;
    margin-left: auto;
    margin-right: auto; 
}

.container {
    background-color: #CCC;
    width: 1000px;
    margin-left: auto;
    margin-right: auto; 
}

#navigation {
    width: 1000px;
    background-color: #ececec;
    border-bottom: 2px solid #e2001a;
}

#header {
    background-color: #CCC;
}

#logo {
    display: block;
    margin-left: auto;
    margin-right: auto;
}

#cssmenu ul,
#cssmenu li,
#cssmenu span,
#cssmenu a {
  margin: 0;
  padding: 0;
  position: relative;
}
#cssmenu {
  height: 49px;
  background: #ececec;
  width: 1000px;
  margin-left: auto;
  margin-right: auto;
}
#cssmenu:after,
#cssmenu ul:after {
  content: '';
  clear: both;
}
#cssmenu a {
  background: #ececec;
  color: #000;
  display: inline-block;
  font-family: Helvetica, Arial, Verdana, sans-serif;
  font-size: 12px;
  line-height: 49px;
  padding: 0 30px;
  text-decoration: none;
}
#cssmenu ul {
  list-style: none;
}
#cssmenu > ul {
  float: left;
}
#cssmenu > ul > li {
  float: left;
}
#cssmenu > ul > li > a {
  color: #000;
  font-size: 18px;
}
#cssmenu > ul > li:hover:after {
  content: '';
  display: block;
  width: 0;
  height: 0;
  position: absolute;
  left: 50%;
  bottom: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 10px solid #e2001a;
  margin-left: -10px;
}
#cssmenu > ul > li.active:after {
  content: '';
  display: block;
  width: 0;
  height: 0;
  position: absolute;
  left: 50%;
  bottom: 0;
  border-left: 10px solid transparent;
  border-right: 10px solid transparent;
  border-bottom: 10px solid #e2001a;
  margin-left: -10px;
}
#cssmenu > ul > li.active > a {
  -moz-box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.1);
  -webkit-box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.1);
  box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.1);
  background: #e2001a;
  color: #fefefe;
}
#cssmenu > ul > li:hover > a {
  background: #ececec;
  -moz-box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.1);
  -webkit-box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.1);
  box-shadow: inset 0 0 2px rgba(0, 0, 0, 0.1);
  color: black;
}
#cssmenu > ul > li.active:hover > a {
    background: #e2001a;
    color: #fefefe;
}
#cssmenu .has-sub {
  z-index: 1;
}
#cssmenu .has-sub:hover > ul {
  display: block;
}
#cssmenu .has-sub ul {
  display: none;
  position: absolute;
  width: 200px;
  top: 100%;
  left: 0;
}
#cssmenu .has-sub ul li {
  *margin-bottom: -1px;
}
#cssmenu .has-sub ul li a {
  background: #e2001a;
  border-bottom: 1px dotted #ff1631;
  filter: none;
  font-size: 11px;
  display: block;
  line-height: 120%;
  padding: 10px;
  color: #ffffff;
}
#cssmenu .has-sub ul li:hover a {
  background: #af0014;
}
#cssmenu .has-sub .has-sub:hover > ul {
  display: block;
}
#cssmenu .has-sub .has-sub ul {
  display: none;
  position: absolute;
  left: 100%;
  top: 0;
}
#cssmenu .has-sub .has-sub ul li a {
  background: #af0014;
  border-bottom: 1px dotted #ff1631;
}
#cssmenu .has-sub .has-sub ul li a:hover {
  background: #950011;
}

#footer {
    height: 50px;
    overflow: hidden;
    padding-bottom: 30px;
    background-color: #ccc;
    border-top: #e2001a 2px solid;
    float: left;
    margin-top: 15px;
}

#footer p {
    line-height: normal;
    text-align: center;
    text-shadow: 1px 1px 0px #FFFFFF;
    color: #696969;
    font-size: 13px;
    font-family: Tahoma, Geneva, sans-serif;
}

#footer a {
    text-decoration: underline;
    color: #696969;
}

#footer a:hover {
    text-decoration: none;
    color: #000000;
}

.content {
    width: 625px;
    float: left;
    padding-top: 15px;
    padding-left: 15px;
    padding-bottom: 12px;
    padding-right: 15px;
    overflow: hidden;
    background-color: #FFF;
    margin-left: 15px;
    margin-top: 15px;
}

.content p {
    margin-top: 0;
    color: #494949;
}

.content p.last {
    margin-bottom: 8px;
}

.content a {
    color: #e2001a;
    text-decoration: none;
    font-weight: bold;
}

.content a:hover {
    color: #494949;
    text-decoration: underline;
}

.content li {
    color: #494949;
}

.sidebar {
    width: 270px;
    padding-top: 15px;
    padding-left: 15px;
    padding-right: 15px;
    padding-bottom: 12px;
    overflow: hidden;
    background-color: #FFF;
    margin-top: 15px;
    margin-left: 15px;
    margin-bottom: 15px;
}

#bodyp {
    background-color: #CCC;
    overflow: hidden;
}

h1 {
    margin: 0;
    padding: 0;
    text-align: center;
}

h2 {
    margin: 0;
    padding: 0;
    text-align: center;
}

.boxcontent {
    width: 670px;
    float: left;
}

.boxsidebar {
    float: left;
}

Any and all help would be greatly appreciated! Thank you!

2 Answers2

1

You can change this on your CSS:

#cssmenu > ul {
   /*float:left --- Remove this*/
   display:inline-block; /*Add this*/;
}
#cssmenu {
   text-align:center; /*Add this*/
}
DaniP
  • 37,813
  • 8
  • 65
  • 74
0

This is what can helps you:

<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1.0, user-scalable=no">
user1956570
  • 132
  • 1
  • 6