2015-03-02 100 views
0

我確定我不是第一個體驗這個的人,但問題來了:我的網站在Firefox中看起來不錯,但在Dreamweaver和Chrome中很糟糕。我一直在Firefox中編輯CSS直播,然後將其複製並粘貼到Dreamweaver中,這一切都很棘手。網站在Firefox中看起來不錯,在Chrome中很糟

下面是它應該看與不看在Firefox的方式:

http://postimg.org/image/7gcm1tjxh/

中和鉻/ Dreamweaver中:

http://postimg.org/image/ikq6ho2dp/

正如你可以看到頂部導航欄垂直,而不是水平。而且頁腳也在Chrome中聚集在一起。

我繼續前進,幷包含了我所有的代碼,因爲我可能在另一個與另一個元素相矛盾的元素中指定了某些內容。

什麼是解決方案讓菜單回到水平和頁腳在每個瀏覽器中看起來正確?

@charset "UTF-8"; 
 

 
/* http://meyerweb.com/eric/tools/css/reset/ 
 
    v2.0 | 20110126 
 
    License: none (public domain) 
 
*/ 
 

 
/* HTML5 display-role reset for older browsers */ 
 

 
ol, ul { 
 
\t list-style: none; 
 
} 
 

 
html { 
 
\t background-color:#96d5cd; 
 
} 
 

 

 
#container { 
 
\t width:980px; 
 
\t border:1px solid #1f5c54; 
 
\t background-color:white; 
 
\t margin:2em auto; 
 
} 
 

 
hr { 
 
padding:0px; 
 
margin:0px; 
 
display:block; 
 
border-bottom: 1px solid black; 
 
clear:both; 
 
} 
 

 
#footer { 
 
\t text-decoration:none; 
 
\t color:black; 
 
\t text-transform:uppercase; 
 
\t font-family:amaranth, trebuchet, verdana, sans-serif; 
 
margin-left:12px; 
 
clear:both; 
 
} 
 

 
#footer li { 
 
display:inline; 
 
clear:both; 
 
} 
 

 
#footer ul{ 
 
margin-left:-37px; 
 
margin-top:-30px; 
 
} 
 

 
#main { 
 
position:relative; 
 
background-color:#fec161; 
 
height:700px; 
 
margin-top:-10px; 
 
margin-left:10px; 
 
margin-right:10px; 
 
} 
 

 
#main #content { 
 
margin-top:10px; 
 
margin-left:10px; 
 
margin-right:10px; 
 
height:400px; 
 
text-align:justify; 
 
} 
 

 
#nav { 
 
\t text-decoration: none; 
 
\t color: black; 
 
\t text-transform: uppercase; 
 
\t font-family: patua-one; 
 
\t font-style: normal; 
 
\t font-weight: 400; 
 
background-color:#fec161; 
 
width:920px; 
 
height:70px; 
 
margin-left:10px; 
 
margin-top:60px; 
 
} 
 

 
#nav li{ 
 
display:inline; 
 
} 
 

 
#navigation { 
 
margin-left:-30px; 
 
padding-top:15px; 
 
} 
 

 
#social { 
 
float:right; 
 
} 
 

 
#social li { 
 
margin-right:10px; 
 
margin-bottom:20px; 
 
display:inline; 
 
} 
 

 
a { 
 
\t text-decoration: none; 
 
\t color: black; 
 
\t margin-top: 0px; 
 
\t font-style: normal; 
 
} 
 

 
a:hover { 
 
\t text-decoration:none; 
 
\t color:#1e777b; 
 
} 
 

 
#feature { 
 
padding-left:10px; 
 
overflow:hidden; 
 
width:960px; 
 
margin-top:-30px; 
 
} 
 

 

 
#footer { 
 
\t font-family:amaranth; 
 
\t text-decoration:none; 
 
\t color:black; 
 
\t text-transform:uppercase; 
 
\t margin-top:0px; 
 
} 
 

 
#header { 
 
\t font-family:patua-one; 
 
\t text-decoration:none; 
 
\t color:black; 
 
\t text-transform:uppercase; 
 
\t margin-top:0px; 
 
\t font-size:24px; 
 
} 
 

 
#header img { 
 
\t float:left; 
 
margin-left:10px; 
 
margin-top:10px; 
 
} 
 

 
h1 { 
 
\t font-size: 24px; 
 
\t font-family: patua-one; 
 
\t font-style: normal; 
 
\t font-weight: 400; 
 
\t text-transform: uppercase; 
 
padding-top:10px; 
 
} 
 

 
#column1 { 
 
float:left; 
 
width:275px; 
 
margin-left:10px; 
 
margin-right:30px; 
 
text-align:justify; 
 
} 
 

 
#column2 h2{ 
 
float:left; 
 
width:275px; 
 
margin-left:90px; 
 
} 
 

 
#column2 { 
 
float:left; 
 
width:275px; 
 
margin-right:0px; 
 
text-align:justify; 
 
margin-left:20px; 
 
} 
 

 

 
#column3 { 
 
float:right; 
 
width:275px; 
 
margin-right:10px; 
 
text-align:justify; 
 
} 
 

 
#column3 h2 { 
 
\t float:left; 
 
\t width:275px; 
 
\t margin-left:220px; 
 
} 
 

 
h2 { 
 
\t font-weight: 400; 
 
\t text-transform: uppercase; 
 
\t line-height: 100%; 
 
\t @import url(http://fonts.googleapis.com/css?family=Patua+One); 
 
\t font-family: patua-one; 
 
\t font-style: normal; 
 
\t font-size:24px; 
 
} 
 

 
#columns { 
 
\t margin-top:20px; 
 
} 
 

 
h3 { 
 
font-family:amaranth; 
 
} 
 

 
div span.welcome { 
 
\t font-size: 24px; 
 
\t font-family: patua-one; 
 
\t font-style: normal; 
 
\t font-weight: 400; 
 
\t text-transform: uppercase; 
 
}
<!doctype html> 
 
<html> 
 
<head> 
 
<meta charset="UTF-8"> 
 
<title>WELCOME :: Katie J Hunter :: Graphic Designer</title> 
 

 
<link ref="css/style.css" rel="stylesheet" type="text/css" /> 
 
<link rel="shortcut icon" href="file:///MacHD/Users/Katie/Desktop/MyNewPortfolio/images/favicon.ico" /> 
 
<link href="css/style.css" rel="stylesheet" type="text/css"> 
 
<link rel="stylesheet" type="text/css" href="http://fonts.googleapis.com/css?family=Patua+One"> 
 
<!--The following script tag downloads a font from the Adobe Edge Web Fonts server for use within the web page. We recommend that you do not modify it.--> 
 
<script>var __adobewebfontsappname__="dreamweaver"</script> 
 
<script src="http://use.edgefonts.net/patua-one:n4:default;amaranth:n4:default.js" type="text/javascript"></script> 
 

 
</head> 
 

 
<body> 
 

 
<div id="container"> 
 

 
\t <div id="header"> 
 
    <img src="images/KatieHunterLogo.png" alt="Katie Hunter Graphic Designer Logo" /><br /> 
 
    
 
    <br /> 
 
    
 
    <ul id="social"> 
 
    \t <p><li><a href="https://www.facebook.com/pages/Katie-Hunter-Graphic-Designer/1532575640337137" target="_blank"><img src="images/socialmedia_facebook.png" alt="Facebook" /></a></li> 
 
     <li><a href="https://www.twitter.com/kinetickatie" target="_blank"><img src="images/socialmedia_twitter.png" alt="Twitter" /></a></li> 
 
     <li><a href="https://www.linkedin.com/in/katiejohunter" target="_blank"><img src="images/socialmedia_linkedin.png" alt="Linked In" /></a></li> 
 
    </p></ul> 
 
    
 
    <ul><p> 
 
    <div id="navigation"> 
 
    <li><a href="index.html" target="_blank">Home</a> :: </li> 
 
    <li><a href="about.html" target="_blank">About</a> ::</li> 
 
    <li><a href="services.html" target="_blank">Services</a> :: </li> 
 
    <li><a href="portfolio.html" target="_blank">Portfolio</a> :: </li> 
 
    <li><a href="blog.html" target="_blank">Blog</a> :: </li> 
 
    <li><a href="contact.html" target="_blank">Contact</a></li> 
 
    </div><!-- end navigation --></ul> 
 
\t </div><!-- end header --> 
 
    
 
    <div id="feature"> 
 
    
 
    \t <img src="images/FeatureBanner.jpg" alt="banner" class="banner" /><br> 
 
    
 
    </div><!-- end feature --> 
 
    
 
    <div id="main"> 
 
    \t <div id="content"> 
 
     <h1><span class="welcome">Welcome!</span></h1> 
 
     <hr style="height:1px; width:100%; border:1px solid black; background-color:black;" /> 
 
     
 
     <h3> 
 
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis sapien velit, dictum vel semper id, vestibulum eu nisi. Phasellus ac ornare sapien. Praesent eget libero mollis ipsum eleifend lacinia non ut ligula. Sed quis sem at est laoreet aliquet. Donec ornare, ante ut fermentum ullamcorper, enim purus vehicula sem, non feugiat dolor nulla sed enim. Etiam odi o nibh, bibendum vel eros malesuada, elementum blandit quam. Integer aliquet finibus felis et eleifend. 
 

 
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis sapien velit, dictum vel semper id, vestibulum eu nisi. Phasellus ac ornare sapien. Praesent eget libero mollis ipsum eleifend lacinia non ut ligula. Sed quis sem at est laoreet aliquet. Donec ornare, ante ut fermentum ullamcorper, enim purus vehicula sem, non feugiat dolor nulla sed enim. Etiam odio nibh, bibendum vel eros malesuada, elementum blandit quam. Integer aliquet finibus felis et eleifend. 
 

 
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis sapien velit, dictum vel semper id, vestibulum eu nisi. Phasellus ac ornare sapien. Praesent eget libero mollis ipsum eleifend lacinia non ut ligula. Sed quis sem at est laoreet aliquet. Donec ornare, ante ut fermentum ullamcorper, enim purus vehicula sem, non feugiat dolor nulla sed enim. Etiam odio nibh, bibendum vel eros malesuada, elementum blandit quam. Integer aliquet finibus felis et eleifend.</h3> 
 
\t \t </div><!-- end content --> 
 
      <div id="columns"> 
 
      <div id="column1"> 
 
    <h2>Services</h2> 
 
    <hr style="height:1px; width:100%; border:1px solid black; background-color:black;" /> 
 
\t <h3>Donec ornare, ante ut fermentum ullamcorper, enim purus vehicula sem, non feugiat dolor nulla sed enim.</h3> 
 
    </div><!-- end column1 --> 
 

 
    <div id="column2"> 
 
    <h2>Clients</h2> 
 
    <hr style="height:1px; width:100%; border:1px solid black; background-color:black;" /> 
 
     \t <h3>Donec ornare, ante ut fermentum ullamcorper, enim purus vehicula sem, non feugiat dolor nulla sed enim.</h3> 
 
    </div><!-- end column2 --> 
 

 
    <div id="column3"> 
 
    <h2>Blog</h2> 
 
    <hr style="height:1px; width:100%; border:1px solid black; background-color:black;" /> 
 
    <h3>Donec ornare, ante ut fermentum ullamcorper, enim purus vehicula sem, non feugiat dolor nulla sed enim.</h3> 
 
    </div><!-- end column3 --> 
 
    \t </div><!-- end columns --> 
 
    </div><!-- end main --> 
 
    
 
    \t <div id="footer"> 
 
     © copyright 2015 katie j hunter • all rights reserved</span> 
 
     <ul> 
 
    \t \t <li><a href="file:///MacHD/Users/Katie/Desktop/MyNewPortfolio/index.html" target="_blank">Home</a></li> | 
 
    \t \t <li><a href="file:///MacHD/Users/Katie/Desktop/MyNewPortfolio/about.html" target="_blank">About</a></li> | 
 
    \t \t <li><a href="file:///MacHD/Users/Katie/Desktop/MyNewPortfolio/services.html" target="_blank">Services</a></li> | 
 
    \t \t <li><a href="file:///MacHD/Users/Katie/Desktop/MyNewPortfolio/portfolio.html" target="_blank">Portfolio</a></li> | 
 
    \t \t <li><a href="file:///MacHD/Users/Katie/Desktop/MyNewPortfolio/blog.html" target="_blank">Blog</a></li> | 
 
    \t \t <li><a href="file:///MacHD/Users/Katie/Desktop/MyNewPortfolio/contact.html" target="_blank">Contact</a></li> 
 
    \t </ul> 
 
     </div><!-- end footer --> 
 

 
</div><!-- end container --> 
 

 

 

 
</body> 
 
</html>

+0

嘗試在css中使用** webkit **屬性來支持不同的瀏覽器。 – SHAZ 2015-03-02 06:39:23

回答

0

我會建議使用引導程序框架的工作。它支持最新的移動和瀏覽器。

[http://www.bootply.com/4kihU2HqGf][1] 


    [1]: http://getbootstrap.com/ 




    /* CSS used here will be applied after bootstrap.css *//* CSS used here will be applied after bootstrap.css */ 
/* CSS used here will be applied after bootstrap.css */ 
.logo { 
    width: 210px; 
    } 
    .jumbotron { 

    } 
h1.name { 
    color: #125952; 
    border-bottom: 4px solid #ffbc6b; 
    margin-bottom: -19px; 

    } 

    .primary { 
    background-color: #ffbc6b; 
    border-radius: 1px; 

    } 
    .main-content { 
    background-color: #ffbc6b; 
    } 
    .navbar-default .navbar-nav > li > a { 
    color: #000; 
     } 


    .welcome { 
    border-bottom: 4px solid #000; 
     color: #000; 
     padding-bottom: 8px; 
      } 
     p { 
    color: #000; 
     font-weight: 400px; 
     } 

     .columns { 
      color: #000; 
      border-bottom: 3px solid #000; 
      padding-bottom: 8px; 
      margin-bottom: 8px; 
      } 
    section { 
     background-color: #ffbc6b; 
     padding: 10px; 
    } 
    .row { 
     background-color: #ffbc6b; 

    } 

    .footer { 
     background-color: #fff; 

     margin: -12px 0px 0 -44px !important; 

    } 

.navbar-default { 
    border: none; 
    } 

.copyright{ 
    margin-top: 10px; 

    } 
    <div class="container"> 
    <header> 
    <div class="logo"> 
     <h1 class="name">Katie Hunter</h1> 
     <h3 class="subtitle">Graphic Designer</h3> 
    </div><!-- end logo --> 

    <nav class="navbar navbar-default primary"> 
    <div class="container-fluid"> 
    <!-- Brand and toggle get grouped for better mobile display --> 
    <div class="navbar-header"> 
     <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1"> 
     <span class="sr-only">Toggle navigation</span> 
     <span class="icon-bar"></span> 
     <span class="icon-bar"></span> 
     <span class="icon-bar"></span> 
     </button> 

    </div> 

    <!-- Collect the nav links, forms, and other content for toggling --> 
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1"> 
     <ul class="nav navbar-nav"> 
     <li><a href="#">HOME :: <span class="sr-only">(current)</span></a></li> 
     <li><a href="#">ABOUT ::</a></li> 
     <li><a href="#">SERVICES ::</a></li> 
     <li><a href="#">PORTFOLIO ::</a></li> 
     <li><a href="#">BLOG ::</a></li> 
     <li><a href="#">CONTACT ::</a></li> 

     </ul> 

     <ul class="nav navbar-nav navbar-right"> 
     <li><a href="#">Link</a></li> 
     <li><a href="#">Link</a></li> 
     <li><a href="#">Link</a></li> 

     </ul> 
    </div><!-- /.navbar-collapse --> 
    </div><!-- /.container-fluid --> 
</nav> 


    <!-- end nav --> 

    </header><!-- header --> 

    <div class="jumbotron"> 
    <h1>Your images goes here!</h1> 

    </div> 

    <div class="container-fluid main-content"> 
    <div class="col-sm-12"> 
    <h1 class="welcome">Welcome</h1> 
    <p><strong>lorem Ipsum is simply dummy text of the printing and typesetting industry. 
     Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, 
     when an unknown printer took a galley of type and scrambled it to make a type 
     specimen book. 
     It has survived not only five centuries, but also the leap into electronic 
     typesetting, remaining essentially unchanged. It was popularised in the 1960s with 
     the release of Letraset sheets containing Lorem Ipsum passages, and more 
     recently with desktop publishing 
     software like Aldus PageMaker including versions of Lorem Ipsum. 

     It is a long established fact that a reader will be distracted by the 
     readable content of a page when looking at its layout. The point of using 
     Lorem Ipsum is that it has a more-or-less normal distribution of letters, as 
     opposed to using 'Content here, content here', making it look like readable 
     English. Many desktop publishing packages and web page editors now use Lorem 
     Ipsum as their default model text, and a search for 'lorem ipsum' will 
     uncover many web sites still in their infancy. Various versions have 
     evolved over the years, sometimes by accident, sometimes on purpose 
     (injected humour and the like).</strong></p> 
    </div><!-- end of col --> 


     <div class="col-sm-4"> 
      <h2 class="columns">SERVICES</h2> 
      <p>lorem Ipsum is simply dummy text of the printing and typesetting industry. 
      Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, 
      when an unknown printer took a galley of type and scrambled it to make a type 
      specimen book.</p> 

     </div> 

     <div class="col-sm-4"> 
      <h2 class="columns">SERVICES</h2> 
      <p>lorem Ipsum is simply dummy text of the printing and typesetting industry. 
      Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, 
      when an unknown printer took a galley of type and scrambled it to make a type 
      specimen book.</p> 

     </div> 

     <div class="col-sm-4"> 
      <h2 class="columns">SERVICES</h2> 
      <p>lorem Ipsum is simply dummy text of the printing and typesetting industry. 
      Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, 
      when an unknown printer took a galley of type and scrambled it to make a type 
      specimen book.</p> 

     </div> 
</div><!-- end of container-fluid --> 



     <div class="container copyright"> 
     <div class="col-sm-6 "> 
      <p>© COPYRIGHT 2015 Katie J Hunter - ALL RIGHTS RESERVED</p> 
      <nav class="navbar navbar-default"> 
    <div class="container-fluid"> 
    <!-- Brand and toggle get grouped for better mobile display --> 




     <ul class="nav navbar-nav footer"> 
     <li><a href="#">HOME <span class="sr-only">(current)</span></a></li> 
     <li><a href="#">ABOUT</a></li> 
     <li><a href="#">SERVICES</a></li> 
     <li><a href="#">PORTFOLIO</a></li> 
     <li><a href="#">BLOG</a></li> 
     <li><a href="#">CONTACT</a></li> 

     </ul> 



    </div><!-- /.container-fluid --></nav></div> 
0
在你的CSS

,已指定#nav li,而元素要進行內聯是#navigation li

你也給footer ulmargin-top: -37px,這是造成UL到與版權信息捆綁在一起。

P.S:我無法打開圖像,因爲我在代理之後,但我猜這是你想要的。

0

您的HTML無效。您將<p><div>標記用作列表元素(ul)的子元素。

嘗試替換例如這樣的:

<ul><p> 
<div id="navigation"> 
<li><a href="index.html" target="_blank">Home</a> :: </li> 
<li><a href="about.html" target="_blank">About</a> ::</li> 
<li><a href="services.html" target="_blank">Services</a> :: </li> 
<li><a href="portfolio.html" target="_blank">Portfolio</a> :: </li> 
<li><a href="blog.html" target="_blank">Blog</a> :: </li> 
<li><a href="contact.html" target="_blank">Contact</a></li> 
</div><!-- end navigation --></ul> 

隨着指出:

<div id="navigation"> 
    <ul> 
     <li><a href="index.html" target="_blank">Home</a> :: </li> 
     <li><a href="about.html" target="_blank">About</a> ::</li> 
     <li><a href="services.html" target="_blank">Services</a> :: </li> 
     <li><a href="portfolio.html" target="_blank">Portfolio</a> :: </li> 
     <li><a href="blog.html" target="_blank">Blog</a> :: </li> 
     <li><a href="contact.html" target="_blank">Contact</a></li> 
    </ul> 
</div><!-- end navigation --> 
相關問題