CSS使菜单栏缩小

时间:2016-04-30 11:59:54

标签: css

所以我的注册/登录CSS和我的菜单栏的CSS是水平的。在具有register.css的页面上,菜单栏似乎缩小了。 在没有register.css的页面上,菜单栏很好。 为什么是这样?我需要改变什么?

menu.css

body, div, h1, h2, h3, h4, h5, h6, p, ul, ol, li, dl, dt, dd, img, form, fieldset, input, textarea, blockquote {
    margin: 0; padding: 0; border: 0;
}

body {
    background:  #0ca3d2;
    font-family: Helvetica, sans-serif; font-size: 16px; line-height: 24px;
}

nav {
    margin: 5px auto; 
    text-align: center; 
}

nav ul ul {
    display: none;
}

    nav ul li:hover > ul {
        display: block;
    }

nav ul {
    background: #efefef; 
    background: linear-gradient(top, #efefef 0%, #bbbbbb 100%);  
    background: -moz-linear-gradient(top, #efefef 0%, #bbbbbb 100%); 
    background: -webkit-linear-gradient(top, #efefef 0%,#bbbbbb 100%); 
    box-shadow: 0px 0px 9px rgba(0,0,0,0.15);
    border-radius: 10px;  
    list-style: none;
    position: relative;
    display: inline-table;
}
    nav ul:after {
        content: ""; clear: both; display: block;
    }

    nav ul li {
        float: left;
    }
        nav ul li:hover {
            background: #4b545f;
            background: linear-gradient(top, #4f5964 0%, #5f6975 40%);
            background: -moz-linear-gradient(top, #4f5964 0%, #5f6975 40%);
            background: -webkit-linear-gradient(top, #4f5964 0%,#5f6975 40%);
        }
            nav ul li:hover a {
                color: #fff;
            }

        nav ul li a {
            display: block; padding: 10px 30px;
            color: #757575; text-decoration: none;
        }


    nav ul ul {
        background: #5f6975; border-radius: 0px; padding: 0;
        position: absolute; top: 100%;
    }
        nav ul ul li {
            float: none; 
            border-top: 1px solid #6b727c;
            border-bottom: 1px solid #575f6a; position: relative;
        }
            nav ul ul li a {
                padding: 5px 20px;
                color: #fff;
            }   
                nav ul ul li a:hover {
                    background: #4b545f;
                }

    nav ul ul ul {
        position: absolute; left: 100%; top:0;
    }

register.css / login.css

body { 
  font: 13px/20px 'Lucida Grande', Tahoma, Verdana, sans-serif;
  color: #404040;
  background: #0ca3d2;
}
.container {
  margin: 80px auto;
  margin-left: 425px;
  margin-top: 90px;
  width: 600px;
}
.register {
  position:relative;
  margin: 20px auto;
  padding: 20px 20px 20px;
  width: 250px;
  background: white;
  border-radius: 3px;
  box-shadow: 0 0 200px rgba(white, .5), 0 1px 2px rgba(black, .3)); 
  &:before {
     content: '';
    position: absolute;
    top: -8px; right: -8px; bottom: -8px; left: -8px;
    z-index: -1;
    background: rgba(black, .08);
    border-radius: 4px;
  }

  h1 {
    margin: -20px -20px 21px;
    line-height: 40px;
    font-size: 15px;
    font-weight: bold;
    color: #555;
    text-align: center;
    text-shadow: 0 1px white;
    background: #f3f3f3;
    border-bottom: 1px solid #cfcfcf;
    border-radius: 3px 3px 0 0;
    linear-gradient:top, whiteffd, #eef2f5;
     box-shadow:0 1px #f5f5f5;
  }
  p { margin: 20px 0 0; }
  p:first-child { margin-top: 0; }
  input[type=number], input[type=password], input[type=tel], input[type=email], input[type=date], input[type=number] { width: 278px; }

  .submit { text-align: center; }
}
:-moz-placeholder {
  color: #c9c9c9 !important;
  font-size: 13px;
}
::-webkit-input-placeholder {
  color: #ccc;
  font-size: 13px;
}
input {
  font-family: 'Lucida Grande', Tahoma, Verdana, sans-serif;
  font-size: 14px;
}
input[type=text], input[type=number], input[type=password], input[type=tel], input[type=email], input[type=date], input[type=number] {
  margin: 5px;
  padding: 0 10px;
  padding-left: 10px;
  width: 200px;
  height: 34px;
  color: #404040;
  background: white;
  border: 1px solid;
  border-color: #c4c4c4 #d1d1d1 #d4d4d4;
  border-radius: 2px;
  outline: 5px solid #eff4f7;
  &:focus {
    border-color: #7dc9e2;
    outline-color: #dceefc;
    outline-offset: 0; // WebKit sets this to -1 by default
  }
}
input[type=submit] {
  padding: 0 18px;
  height: 29px;
  font-size: 12px;
  font-weight: bold;
  color: #527881;
  text-shadow: 0 1px #e3f1f1;
  background: #cde5ef;
  border: 1px solid;
  border-color: #b4ccce #b3c0c8 #9eb9c2;
  border-radius: 16px;
  outline: 0;
  @include box-sizing(content-box); // Firefox sets this to border-box by default
  @include linear-gradient(top, #edf5f8, #cde5ef);
  @include box-shadow(inset 0 1px white, 0 1px 2px rgba(black, .15));
  &:active {
    background: #cde5ef;
    border-color: #9eb9c2 #b3c0c8 #b4ccce;
    @include box-shadow(inset 0 0 3px rgba(black, .2));
  }
}
.lt-ie9 {
  input[type=text], input[type=password] { line-height: 34px; }
}

更新 我已添加以下预览:

Normal Menu

Shrinked Menu

相关HTML:

  <?php
    include("menu_admin.php");
    ?>
     <html>
   <head>
      <meta charset="utf-8">
      <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
      <title>Register User</title>
      <link rel="stylesheet" type="text/css" href="register.css">
      <!--[if lt IE 9]><script src="//html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
   </head>
   <body>
      <section class="container">
      <div class="register">
      <h1>Register Cadet</h1>
      <form action="process_register.php" method="POST"/>
         <div class="help-tip">
            <p>Enter a suitable ID with only numbers. Create a strong password and enter it again</p>
         </div>
         <br>
         <p><input type="number"     name="ID"   id="ID"   placeholder="Cadet_ID*" autofocus required></p>
         <br> 
         <p><input type="password" name="Password"   id="Password"   placeholder="Password*" required></p>
         <br>
         <p><input type="password" name="Password_2" id="Password_2" placeholder="Re-enter Password*"  required></p>
         <br>
         <p>
            Status*
            <select name="Status" id="Status">
               <option value="0">User</option>
               <required>
            </select>
         </p>
         <br>
         <p class="submit"><input type="submit" name="commit" value="Next"></p>
      </form>
   </body>
</html>

0 个答案:

没有答案