CSS样式-元素在导航到不同页面时会略有移动



由于某些原因,当我在网站上导航到不同的页面时,某些元素似乎会根据你所处的页面略有移动。以下是元素移动的短片。正如你所看到的,我的网站的元素似乎有点移动,我不知道为什么。如果有人能帮我制作它,让所有东西在导航到不同页面时保持静止,我将不胜感激

以下是我的CSS样式:

/*CSS FOR ALL PAGES*/
/*BODY/WRAPPER SECTION*/
body {background:url('E:/Server/CRAFT412-Website/images/SiteBackground.png');
      background-repeat: no-repeat;
      background-attachment: fixed;}
#wrapper {width: 1000px;
          margin: 0 auto;
          background-color: white;
          border-radius: 5px;
          box-shadow: 0px 1px 5px;}
/*TOP BANNER SECTION*/
#logo {margin-top: -90px;
       margin-bottom: -95px;
       text-align: center;}
#ip {float: left;
     margin-left: 458px;
     margin-top: -55px;}
#ip_text {float: left;
          margin-left: 449px;
          margin-top: -51px;
          color: white;
          font-size: 15px;}
#teamspeak_logo {float:right;
                 margin-right: 450px;
                 margin-top: -55px;}
/*TOP NAV BAR SECTION*/
* {margin: 0px;
   padding: 0px;}
#nav_bar {background-color: #a22b2f;
          box-shadow: 0px 1px 10px;
          height: 45px;
          text-align: center;
          border-top-left-radius: 5px;
          border-top-right-radius: 5px;}
#nav_bar ul {padding: 0;}
#nav_bar > ul > li {display: inline-block;}
#nav_bar ul > li > a {color: white;
                      display: block;
                      text-decoration: none;
                      font-weight: normal;
                      padding-left: 15px;
                      padding-right: 15px;
                      line-height: 45px;
                      transition: all 0.5s ease;}
#nav_bar ul li ul {display: none;
                   list-style: none;
                   position: absolute;
                   background: white;
                   margin-left:0px;
                   box-shadow: 0px 1px 5px;
                   text-align: left;
                   z-index:1;}
#nav_bar ul li a.active-page {background-color: #8c1d20;}
#nav_bar ul li:hover ul li a {line-height: 2em;}
#nav_bar ul li a:hover {background: #8c1d20;}
#nav_bar ul li:hover ul {display: block;}
#nav_bar ul li ul li a {color: #252525;
                        display: block;}
#nav_bar ul li ul li a:hover {background: #4485f5;
                              color: white;}
/*BOTTOM FOOTER SECTION*/
#bottom_footer {height: 50px;
                margin: 0px auto;
                margin-top: 15px;
                margin-bottom: 15px;
                background:white;
                width: 1000px;
                border-radius: 5px;
                box-shadow: 0px 1px 5px;}
#created_by {padding: 17px;
             text-align: center;}
#social_media_youtube {float: left;
                       margin: -46px;
                       margin-left: 315px;}
#social_media_twitch {float: left;
                      margin: -43px;
                      margin-left: 380px;}
#social_media_twitter {float: right;
                       margin: -53px;
                       margin-right: 368px;}
#social_media_facebook {float: right;
                        margin: -47px;
                        margin-right: 325px;}
/*ELEMENT SELECTIONS SECTION*/
p {font-family: Arial, Helvetica, sans-serif;
   margin-left: 20px;
   margin-right: 20px;}
ul {font-family: Arial, Helvetica, sans-serif;
    margin-left: 37px;}
h3 {font-family: Arial, Helvetica, sans-serif;
    margin-left: 20px;}
h4 {font-family: Arial, Helvetica, sans-serif;
    margin-left: 20px;}

这是来自索引页面的HTML:

<!DOCTYPE HTML>
<html>
<head>
    <title>CRAFT412 - Home</title>
</head>
<!--PAGE LINKS-->
<link href="css/styles.css" rel="stylesheet" type="text/css" media="screen">
<link href="css/index.css" rel="stylesheet" type="text/css" media="screen">
<!--HTML FOR ALL PAGES-->
<!--BODY SECTION-->
<body>
    <!--TOP BANNER SECTION-->
    <div id="banner">
                   <div id="logo"> 
                                <img src="images/CRAFT412 - Logo.png" width="500" height="281" alt="CRAFT412">
                            </div>
                   <div id="ip">
                              <img class="top" src="images/CRAFT412 - Box - IP.png" alt="IP">
                           </div>
                   <div id="ip_text">
                                   <p>SERVER IP<P/>
                                   <p>craft412.serveminecraft.net<P/>
                               </div>
                   <div id="teamspeak_logo"> 
                                          <a href="ts3server://craft412.serveminecraft.net:9987">
                                          <img src="images/CRAFT412 - Box - Teamspeak.png" alt="TEAMSPEAK"></a>
                                      </div>                                       
                                  </div>
    <!--WRAPPER SECTION-->
    <div id="wrapper">
                    <!--TOP NAV BAR SECTION-->
                    <div id="nav_bar">
                                    <ul>
                                      <li><a href="index.html" class="active-page">Home</a>
                                      </li
                                      ><li><a href="status.html">Status</a>
                                      </li
                                      ><li><a href="info.html">Info</a>
                                      </li
                                      ><li><a href="">Gamemodes</a> 
                                    <ul>
                                       <li><a href="survival.html">Survival</a>
                                       </li
                                       ><li><a href="pure-pvp.html">Pure-PVP</a>
                                       </li
                                       ><li><a href="gamesworld.html">Gamesworld</a>
                                       </li>
                                    </ul>
                                       </li
                                       ><li><a href="rules.html">Rules</a>
                                       </li
                                       ><li><a href="vote.html">Vote</a>
                                       </li
                                       ><li><a href="contact.html">Contact</a>
                                       </li>
                                    </ul>
                                </div>
                    <!--INDEX CONTENT-->
                    <div id="index_banner">
                                         <img class="bottom" src="images/SPAWN IMAGE.png" alt="INDEX BANNER">
                                         <img class="top" src="images/SURVIVAL IMAGE - GAMEMODES.png" alt="INDEX BANNER 2">
                                     </div>
                    <div id="welcome_text">                                        
                                         <h3>Welcome to CRAFT412</h3>
                                         <h3>We are currently running version 1.8.1</h3>
                                         <h3>Survival / PurePVP / GamesWorld</h3>                                       
                                     </div>
                    <div id="trailer_title">                                   
                                          <h4><br>SERVER TRAILER</h4>
                                      </div>
                    <div id="trailer_video">
                                          <iframe width="832" height="468" src="http://www.youtube.com/embed/dfbWw757Iow"></iframe>
                                      </div>
                                  </div>                                                                                                                            
                    <!--HTML FOR ALL PAGES-->
                    <!--BOTTOM FOOTER SECTION-->
                    <div id="bottom_footer">                    
                                          <div id="created_by">
                                                             <p>© 2015 GR412</p>
                                                         </div>
                                          <div id="social_media_youtube"> 
                                                                       <a href="https://www.youtube.com/user/GR412" target="_blank">
                                                                       <img src="images/CRAFT412 - YouTube Button.png" width="40" height="40" alt="YOUTUBE"></a>
                                                                   </div>
                                          <div id="social_media_twitch"> 
                                                                      <a href="http://www.twitch.tv/gr412" target="_blank">
                                                                      <img src="images/CRAFT412 - Twitch Button.png" width="35" height="35" alt="TWITCH"></a>
                                                                  </div>
                                          <div id="social_media_twitter"> 
                                                                       <a href="https://twitter.com/GR412" target="_blank">
                                                                       <img src="images/CRAFT412 - Twitter Button.png" width="55" height="55" alt="TWITTER"></a>
                                                                   </div>
                                          <div id="social_media_facebook"> 
                                                                        <a href="https://www.facebook.com/GR412" target="_blank">
                                                                        <img src="images/CRAFT412 - Facebook Button.png" width="45" height="40" alt="FACEBOOOK"></a>
                                                                   </div>                                                                
    </div>
</body>
</html>

很可能使用一个或多个"&nbsp;"来分离图像?这些"东西"代表一个(不可破坏的)空间,但是!空格(长度)并不完全相同:这取决于您使用的FONT。例如/通常在php中,您使用includes来合并网页的各个部分。假设您的图像位于header.php部分。然后,根据请求,添加另一个php部分。当该部分使用(通过应用css)除"正常"之外的新字体/其他字体时,这会影响整个页面上的"&nbsp;"。寻找类似的东西

font-family: "Ubuntu", "Trebuchet MS", sans-serif;

你的一些页面上没有。

相关内容

  • 没有找到相关文章

最新更新