如何从HTML页面中删除闪烁?

时间:2012-05-10 07:17:25

标签: html css twitter-bootstrap

我这里有一个模型

http://dummytest.herokuapp.com/

目前普通的香草HTML首先显示然后它闪烁,并且应用CSS渲染。我怎样才能让我的页面显示CSS样式作为完全绕过无样式文本的第一件事?

3 个答案:

答案 0 :(得分:2)

您的文档不是well formed (wiki),这会导致此行为。

通常网页会:

<html>
 <head>
  <!-- meta tags go here along with title, 
      script links, and css style references -->
 </head>
 <body>
  <!-- elements for rendering go here -->
 </body>
</html>

答案 1 :(得分:1)

您希望更正HTML以符合HTML standard

<!DOCTYPE html> 
<html lang="en"> 
<head> 
    <meta charset="utf-8"> 
    <title>Test Harness</title> 
    <meta name="viewport" content="width=device-width, initial-scale=1.0"> 
    <meta name="description" content=""> 
    <meta name="author" content=""> 
    <!--<Le>HTML5 shim, for IE6-8 support of HTML elements</Le>--><!--[if lt IE 9]> 
    <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script><![endif]--><!--<Le>styles</Le>--> 
    <link href="/stylesheets/bootstrap.css" rel="stylesheet"> 
    <link href="/stylesheets/datepicker.css" rel="stylesheet"> 
    <link href="/stylesheets/style.css" rel="stylesheet"> 
    <style>body { 
        padding-top: 30px; /* 60px to make the container go all the way to the bottom of the topbar */ 
    } 
    </style> 
    <script src="http://twitter.github.com/bootstrap/assets/js/google-code-prettify/prettify.js"></script> 
    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script> 
    <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/jquery-ui.js"></script> 
    <script src="/javascripts/slimScroll.min.js"></script>    
    <script src="/javascripts/housefix.js"></script>  
    <script src="/javascripts/bootstrap-transition.js"></script> 
    <script src="/javascripts/bootstrap-alert.js"></script> 
    <script src="/javascripts/bootstrap-datepicker.js"></script>     
    <script src="/javascripts/bootstrap-modal.js"></script> 
    <script src="/javascripts/bootstrap-dropdown.js"></script> 
    <script src="/javascripts/bootstrap-scrollspy.js"></script> 
    <script src="/javascripts/bootstrap-tab.js"></script> 
    <script src="/javascripts/bootstrap-tooltip.js"></script> 
    <script src="/javascripts/bootstrap-popover.js"></script> 
    <script src="/javascripts/bootstrap-button.js"></script> 
    <script src="/javascripts/bootstrap-collapse.js"></script> 
    <script src="/javascripts/bootstrap-carousel.js"></script> 
    <script src="/javascripts/bootstrap-typeahead.js"></script> 
    <meta name="viewport" content="initial-scale=1.0, user-scalable=no" /> 
</head>  
<body> 
    <p> 
        <a href="/">Home</a> |  
        <a href="/login">Log In</a> 
    </p> 
    <h2>Welcome! Please log in.</h2> 
</body> 
</html>

答案 2 :(得分:0)

将您的所有<head></head>代码放在一个位置,将所有<body></body>代码放在一个位置。 目前,您有2套<head><body>。拿上面的一个(带菜单)并将其与下面的一个合并(带欢迎信息)。

最好通过http://validator.w3.org/运行所有网页,以避免此类问题。