如何正确调整跨浏览器的CSS布局?

时间:2016-04-28 18:49:55

标签: jquery html css cross-browser

就像真正的numpty一样,我只在Chrome桌面/移动和Safari手机上进行测试。该网站在这些浏览器上几乎是完美的布局和功能。

我现在才记得Firefox的css内容有点不同,而IE似乎有很大的不同。

我的问题:

Firefox浏览器。

  1. 移动导航下拉列表未显示(主导航栏折叠到移动视图后右上角)
  2. IE 9.

    1. 布局完全被打破,大部分定位为右栏(开始筹款,团队名单等),导航栏,都是不可思议的

    2. 在“了解更多”页面中嵌套在<ul>中的下拉列表无法正常工作

    3. Mobile Nav不会出现

    4. 由于某种原因,在IE9中看起来很稳定的唯一页面是实际的注册页面,导航栏和一切看起来都很完美。

    5. 目前,我正在寻找解决方案来修复未在Firefox或IE中显示的移动导航菜单。

      这是网页:TestPage

      请注意我大约一半时间接管了这个项目,因此导航和移动导航已经完成了

      移动导航CSS:

          .login-btn,
      
          .home-btn,
      
          .reg-pg-btns,
      
          .aboutevent-btn,
      
          .learn-btn,
      
          .donater-btn,
      
          .provinces-btn,
      
          .french-btn {
      
            width: 100%;
      
            display: block;
      
          }
      
          header {
      
            min-height: 60px;
      
            margin-bottom: 5%;
      
          }
      
          #content {
      
            margin: 3% auto;
      
          }
      
          #more-nav-options {
      
            width: 100%;
      
            border-bottom: 5px solid #0079C2;
      
            background: white;
      
            float: left;
      
            border-top: 1px solid grey;
      
          }
      
          #more-nav-options a {
      
            display: block;
      
            width: 100%;
      
            padding: 10px 10px 0px 17px;
      
            height: 40px;
      
            box-sizing: border-box;
      
            -moz-box-sizing: border-box;
      
            font: 16px"Rockwell W01", "Rockwell", Georgia, Courier, serif !important;
      
          }
      
          nav {
      
            padding: 0;
      
            position: relative;
      
            z-index: 10;
      
            height: 0;
      
          }
      
          nav ul .left,
      
          .donate-btn,
      
          nav ul li,
      
          .donate-btn:hover {
      
            width: 100%;
      
            max-width: none;
      
            margin: 0;
      
            float: left;
      
          }
      
          nav ul li a {
      
            text-align: center;
      
            border: none !important;
      
          }
      
          .nav {
      
            width: 100%;
      
            float: left;
      
            background: white;
      
            border-top: 1px solid gray;
      
          }
      
          nav ul ul {
      
            width: 100%;
      
          }
      
          .showMenu {
      
            display: block;
      
            background: url(http://convio.cancer.ca/mResponsive/images/icons/BT_menu_64.png) no-repeat center;
      
            background-size: 48px 48px;
      
            height: 80px;
      
            right: 0;
      
            top: 0;
      
            text-indent: -999999px;
      
            font-size: 0;
      
            position: absolute;
      
            z-index: 11;
      
            border-left: 1px solid #DDDDDD;
      
          }
      
          .showMenu2 {
      
            display: block;
      
            width: 60px;
      
            height: 80px;
      
            right: 0;
      
            top: 0;
      
            font-size: 0;
      
            position: absolute;
      
            z-index: 11;
      
            border-left: 1px solid #DDDDDD;
      
          }
      
          .navbar-nav > li > a {
      
            padding-top: 10px;
      
            padding-bottom: 10px;
      
            line-height: 20px;
      
          }
      
          .nav > li > a {
      
            position: relative;
      
            display: block;
      
            padding: 10px 15px;
      
          }
      
          nav ul li {
      
            display: block;
      
            color: #6B6B6B !important;
      
            text-decoration: none;
      
            padding-top: 0px;
      
            padding-right: 0px;
      
            padding-left: 0px;
      
          }
      
          a {
      
            color: #FFEE00;
      
            text-decoration: none;
      
          }
      
          a {
      
            background-color: transparent;
      
          }
      
          user agent stylesheet a:-webkit-any-link {
      
            color: -webkit-link;
      
            text-decoration: underline;
      
            cursor: auto;
      
          }
      
          Inherited from li.right.hover P,
      
          LI,
      
          OL,
      
          UL,
      
          TABLE,
      
          TR,
      
          TH,
      
          TD,
      
          .Explicit {
      
            font-family: Arial, Verdana, Helvetica, sans-serif;
      
            font-size: 10pt;
      
          }
      
          P,
      
          LI,
      
          OL,
      
          UL,
      
          TABLE,
      
          TR,
      
          TH,
      
          TD,
      
          .Explicit {
      
            font-family: Verdana, Arial, Helvetica, sans-serif;
      
            font-size: 10pt;
      
          }
      
          user agent stylesheet li {
      
            display: list-item;
      
            text-align: -webkit-match-parent;
      
          }
      
          Inherited from ul.nav.navbar-nav .nav {
      
            padding-left: 0;
      
            margin-bottom: 0;
      
            list-style: none;
      
          }
      
          nav ul {
      
            padding: 0 0px;
      
            list-style: none;
      
            position: relative;
      
            display: inline-table;
      
            margin: 0;
      
            width: 100%;
      
          }
      
          P,
      
          LI,
      
          OL,
      
          UL,
      
          TABLE,
      
          TR,
      
          TH,
      
          TD,
      
          .Explicit {
      
            font-family: Arial, Verdana, Helvetica, sans-serif;
      
            font-size: 10pt;
      
          }
      
          P,
      
          LI,
      
          OL,
      
          UL,
      
          TABLE,
      
          TR,
      
          TH,
      
          TD,
      
          .Explicit {
      
            font-family: Verdana, Arial, Helvetica, sans-serif;
      
            font-size: 10pt;
      
          }
      
          user agent stylesheet ul,
      
          menu,
      
          dir {
      
            display: block;
      
            list-style-type: disc;
      
            -webkit-margin-before: 1em;
      
            -webkit-margin-after: 1em;
      
            -webkit-margin-start: 0px;
      
            -webkit-margin-end: 0px;
      
            -webkit-padding-start: 40px;
      
          }
      
          nav {
      
            width: 100%;
      
            max-width: 970px;
      
            height: 50px;
      
            margin: 0 auto;
      
          }
      
          nav ul ul {
      
            display: none;
      
          }
      
          nav ul li:hover > ul {
      
            display: block;
      
          }
      
          nav ul {
      
            padding: 0 0px;
      
            list-style: none;
      
            position: relative;
      
            display: inline-table;
      
            margin: 0;
      
            width: 100%;
      
          }
      
          nav ul:after {
      
            content: "";
      
            clear: both;
      
            display: block;
      
          }
      
          nav ul li {
      
            float: left;
      
          }
      
          nav ul li:hover a {
      
            color: #fff;
      
          }
      
          nav ul li a {
      
            display: block;
      
            color: #6B6B6B !important;
      
            text-decoration: none;
      
            padding-top: 0px;
      
            padding-right: 0px;
      
            padding-left: 0px;
      
          }
      
          nav ul ul {
      
            border-radius: 0px;
      
            padding: 0;
      
            position: absolute;
      
            top: 100%;
      
            width: 100%;
      
            max-width: 190px;
      
            padding: 15px 0px 0px;
      
            box-sizing: border-box;
      
            -moz-box-sizing: border-box;
      
            background: white;
      
          }
      
          nav ul ul li {
      
            float: none;
      
            position: relative;
      
          }
      
          nav ul ul li a {
      
            padding: 0px 0px 15px 20px;
      
            color: #6B6B6B;
      
            font: 80% Arial, Helvetica, sans-serif;
      
            text-align: left;
      
            box-sizing: border-box;
      
            -moz-box-sizing: border-box;
      
          }
      
          nav ul ul li a:hover {
      
            color: black !important;
      
            text-shadow: none;
      
          }
      
          nav ul ul ul {
      
            position: absolute;
      
            left: 100%;
      
            top: 0;
      
          }
      
          .main-nav-btn {
      
            width: 100%;
      
            height: 50px;
      
            box-sizing: border-box;
      
            -moz-box-sizing: border-box;
      
            padding: 14px 0px 0px 10px;
      
            border-top: 5px solid;
      
            float: left;
      
            background-color: white;
      
            margin-right: 15px;
      
            font: 15px"Rockwell W01", "Rockwell", Georgia, Courier, serif !important;
      
          }
      
          .home-btn {
      
            width: 180px;
      
            margin-top: 16px;
      
            color: #FFFFFF !important;
      
            background-color: #0066CC;
      
            font: 14px"Rockwell W01", "Rockwell", Georgia, Courier, serif !important;
      
          }
      
          .home-btn:hover,
      
          .home-btnActive {
      
            color: #FFEE00 !important;
      
            background: #1975D1;
      
            font-weight: 900;
      
          }
      
          @media screen and (max-width: 768px) {
      
            .home-btn {
      
              margin-top: 1px;
      
              border-radius: 12px;
      
              background-color: #3498db;
      
              border-color: rgba(0, 0, 0, 0.3);
      
              text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
      
              color: #FFF;
      
              display: inline-block;
      
              text-transform: uppercase;
      
              letter-spacing: 2px;
      
              font-size: 12px;
      
              padding: 10px 30px;
      
              -moz-border-radius: 12px;
      
              -webkit-border-radius: 12px;
      
              border: 1px solid rgba(0, 0, 0, 0.3);
      
              border-bottom-width: 3px;
      
              text-decoration: none;
      
            }
      
          }
      
          @media screen and (max-width: 765px) {
      
            .home-btn {
      
              width: 100%;
      
              margin-top: 1px;
      
              margin-left: 15px;
      
              border-radius: 12px;
      
              background-color: #3498db;
      
              border-color: rgba(0, 0, 0, 0.3);
      
              text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
      
              color: #FFF;
      
              display: inline-block;
      
              text-transform: uppercase;
      
              letter-spacing: 2px;
      
              font-size: 12px;
      
              padding: 10px 30px;
      
              -moz-border-radius: 12px;
      
              -webkit-border-radius: 12px;
      
              border: 1px solid rgba(0, 0, 0, 0.3);
      
              border-bottom-width: 3px;
      
              text-decoration: none;
      
            }
      
          }
      
          .tours-btn {
      
            /* aka Register button */
      
            width: 200px;
      
            margin-top: 16px;
      
            color: #FFFFFF !important;
      
            background-color: #0066CC;
      
            font: 14px"Rockwell W01", "Rockwell", Georgia, Courier, serif !important;
      
          }
      
          .tours-btn:hover,
      
          .toursActive {
      
            color: #FFEE00 !important;
      
            background: #1975D1;
      
            font-weight: 900;
      
          }
      
          @media screen and (max-width: 768px) {
      
            .tours-btn {
      
              width: 100%;
      
              margin-top: 1px;
      
              border-radius: 12px;
      
              background-color: #3498db;
      
              border-color: rgba(0, 0, 0, 0.3);
      
              text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
      
              color: #FFF;
      
              display: inline-block;
      
              text-transform: uppercase;
      
              letter-spacing: 2px;
      
              font-size: 12px;
      
              padding: 10px 30px;
      
              -moz-border-radius: 12px;
      
              -webkit-border-radius: 12px;
      
              border: 1px solid rgba(0, 0, 0, 0.3);
      
              border-bottom-width: 3px;
      
              text-decoration: none;
      
            }
      
          }
      
          @media screen and (max-width: 765px) {
      
            .tours-btn {
      
              width: 100%;
      
              margin-top: 1px;
      
              margin-left: 15px;
      
              border-radius: 12px;
      
              background-color: #3498db;
      
              border-color: rgba(0, 0, 0, 0.3);
      
              text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
      
              color: #FFF;
      
              display: inline-block;
      
              text-transform: uppercase;
      
              letter-spacing: 2px;
      
              font-size: 12px;
      
              padding: 10px 30px;
      
              -moz-border-radius: 12px;
      
              -webkit-border-radius: 12px;
      
              border: 1px solid rgba(0, 0, 0, 0.3);
      
              border-bottom-width: 3px;
      
              text-decoration: none;
      
            }
      
          }
      
          .about-btn {
      
            /* aka Find Fundraiser button */
      
            display: none;
      
            width: 195px;
      
            margin-top: 16px;
      
            color: #FFFFFF !important;
      
            background-color: #0066CC;
      
            font: 14px"Rockwell W01", "Rockwell", Georgia, Courier, serif !important;
      
          }
      
          .about-btn:hover,
      
          .aboutActive {
      
            color: #FFEE00 !important;
      
            background: #1975D1;
      
            font-weight: 900;
      
          }
      
          @media screen and (max-width: 768px) {
      
            .about-btn {
      
              width: 100%;
      
              margin-top: 1px;
      
              border-radius: 12px;
      
              background-color: #3498db;
      
              border-color: rgba(0, 0, 0, 0.3);
      
              text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
      
              color: #FFF;
      
              display: inline-block;
      
              text-transform: uppercase;
      
              letter-spacing: 2px;
      
              font-size: 12px;
      
              padding: 10px 30px;
      
              -moz-border-radius: 12px;
      
              -webkit-border-radius: 12px;
      
              border: 1px solid rgba(0, 0, 0, 0.3);
      
              border-bottom-width: 3px;
      
              text-decoration: none;
      
            }
      
          }
      
          @media screen and (max-width: 765px) {
      
            .about-btn {
      
              width: 100%;
      
              margin-top: 1px;
      
              margin-left: 15px;
      
              border-radius: 12px;
      
              background-color: #3498db;
      
              border-color: rgba(0, 0, 0, 0.3);
      
              text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
      
              color: #FFF;
      
              display: inline-block;
      
              text-transform: uppercase;
      
              letter-spacing: 2px;
      
              font-size: 12px;
      
              padding: 10px 30px;
      
              -moz-border-radius: 12px;
      
              -webkit-border-radius: 12px;
      
              border: 1px solid rgba(0, 0, 0, 0.3);
      
              border-bottom-width: 3px;
      
              text-decoration: none;
      
            }
      
          }
      
          .learn-btn {
      
            /*learn more button */
      
            display: none;
      
            width: 195px;
      
            margin-top: 16px;
      
            color: #FFFFFF !important;
      
            background-color: #0066CC;
      
            font: 14px"Rockwell W01", "Rockwell", Georgia, Courier, serif !important;
      
          }
      
          .learn-btn:hover,
      
          .learnActive {
      
            color: #FFEE00 !important;
      
            background: #1975D1;
      
            font-weight: 900;
      
          }
      
          @media screen and (max-width: 768px) {
      
            .learn-btn {
      
              margin-top: 1px;
      
              border-radius: 12px;
      
              background-color: #3498db;
      
              border-color: rgba(0, 0, 0, 0.3);
      
              text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
      
              color: #FFF;
      
              display: inline-block;
      
              text-transform: uppercase;
      
              letter-spacing: 2px;
      
              font-size: 12px;
      
              padding: 10px 30px;
      
              -moz-border-radius: 12px;
      
              -webkit-border-radius: 12px;
      
              border: 1px solid rgba(0, 0, 0, 0.3);
      
              border-bottom-width: 3px;
      
              text-decoration: none;
      
            }
      
          }
      
          @media screen and (max-width: 765px) {
      
            .learn-btn {
      
              margin-left: 15px;
      
              margin-top: 1px;
      
              border-radius: 12px;
      
              background-color: #3498db;
      
              border-color: rgba(0, 0, 0, 0.3);
      
              text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
      
              color: #FFF;
      
              display: inline-block;
      
              text-transform: uppercase;
      
              letter-spacing: 2px;
      
              font-size: 12px;
      
              padding: 10px 30px;
      
              -moz-border-radius: 12px;
      
              -webkit-border-radius: 12px;
      
              border: 1px solid rgba(0, 0, 0, 0.3);
      
              border-bottom-width: 3px;
      
              text-decoration: none;
      
            }
      
          }
      
          .donater-btn {
      
            width: 200px;
      
            margin-top: 16px;
      
            box-sizing: border-box;
      
            -moz-box-sizing: border-box;
      
            color: #FFEE00 !important;
      
            margin-right: 0px;
      
            background-color: #0066CC;
      
            float: right;
      
            text-transform: uppercase;
      
            font-weight: 900;
      
          }
      
          .donater-btn:hover,
      
          .donater-btnActive {
      
            color: #FFEE00 !important;
      
            background: #1975D1;
      
          }
      
          @media screen and (max-width: 768px) {
      
            .donater-btn {
      
              width: 100%;
      
              margin-top: 1px;
      
              border-radius: 12px;
      
              background-color: #3498db;
      
              border-color: rgba(0, 0, 0, 0.3);
      
              text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
      
              display: inline-block;
      
              text-transform: uppercase;
      
              letter-spacing: 2px;
      
              font-size: 12px;
      
              padding: 10px 30px;
      
              -moz-border-radius: 12px;
      
              -webkit-border-radius: 12px;
      
              border: 1px solid rgba(0, 0, 0, 0.3);
      
              border-bottom-width: 3px;
      
              text-decoration: none;
      
            }
      
          }
      
          @media screen and (max-width: 604px) {
      
            .donater-btn {
      
              width: 100%;
      
              margin-top: 1px;
      
              margin-right: -15px;
      
              border-radius: 12px;
      
              background-color: #3498db;
      
              border-color: rgba(0, 0, 0, 0.3);
      
              text-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
      
              display: inline-block;
      
              text-transform: uppercase;
      
              letter-spacing: 2px;
      
              font-size: 12px;
      
              padding: 10px 30px;
      
              -moz-border-radius: 12px;
      
              -webkit-border-radius: 12px;
      
              border: 1px solid rgba(0, 0, 0, 0.3);
      
              border-bottom-width: 3px;
      
              text-decoration: none;
      
            }
      
          }
      
          a .donater-btn:hover {
      
            width: 100%;
      
            height: 100%;
      
            display: block;
      
          }
      <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
      <a id="responsive-nav" class="showMenu" href="#" title="Navigation Menu">more navigational options</a>
      
      <nav>
        <div>
          <ul class="nav navbar-nav">
      
            <li class="left"><a href="http://convio.cancer.ca/site/TR?fr_id=[[S80:frID]]&pg=entry" class="home-btn" id="home-btn">Home</a>
            </li>
      
            <li class="left"><a href="TR/Events/General?pg=informational&fr_id=[[S80:frID]]&type=fr_informational&sid=9700" class="tours-btn" id="tours-btn">Register</a>
            </li>
      
      
            <li class="left"><a href="TR/Events?pg=pfind&amp;fr_id=[[S80:frID]]" class="about-btn" id="about-btn">Find a Fundraiser</a>
            </li>
      
      
            <li class="left"><a href="TR/Events/General?pg=informational&fr_id=[[S80:frID]]&type=fr_informational&sid=10335" class="learn-btn" id="learn-btn">Learn More</a>
            </li>
      
      
            <li class="right"><a href="TR/Events?pg=pfind&amp;fr_id=[[S80:frID]]" class="donater-btn hvr-buzz-out">DONATE</a>
            </li>
      
      
            <li class="dropdown">
              <a class="dropdown-toggle provinces-btn" data-toggle="dropdown">Select Province<span class="caret"></span></a> 
              <ul class="dropdown-menu">
                <li><a href="#">Alberta</a>
                </li>
                <li><a href="#">British Columbia</a>
                </li>
                <li><a href="#">Manitoba</a>
                </li>
                <li><a href="#">New Brunswick</a>
                </li>
                <li><a href="#">Newfoundland and Labrador</a>
                </li>
                <li><a href="#">Nova Scotia</a>
                </li>
                <li><a href="#">Nunavut</a>
                </li>
                <li><a href="#">Ontario</a>
                </li>
                <li><a href="#">Prince Edward Island</a>
                </li>
                <li><a href="#">Quebec</a>
                </li>
                <li><a href="#">Saskatchewan</a>
                </li>
              </ul>
      
            </li>
      
            <li class="right"><a href="frenchurl" class="french-btn" title="French">Français</a>
      
          </ul>
        </div>
      </nav>

      所有建议都非常感谢。谢谢你的时间。

0 个答案:

没有答案