2013-03-18 61 views
1

我爲我的網站使用Twitter Bootstrap做了一個簡單的設計。代碼如下:Twitter Bootstrap太寬手機

<!DOCTYPE html> 

<!--[if lt IE 7 ]> <html class="ie ie6 no-js" lang="pl-PL"> <![endif]--> 
<!--[if IE 7 ]> <html class="ie ie7 no-js" lang="pl-PL"> <![endif]--> 
<!--[if IE 8 ]> <html class="ie ie8 no-js" lang="pl-PL"> <![endif]--> 
<!--[if IE 9 ]> <html class="ie ie9 no-js" lang="pl-PL"> <![endif]--> 
<!--[if gt IE 9]><!--><html class="no-js" lang="pl-PL"><!--<![endif]--> 

<head> 

    <meta charset="UTF-8"> 
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
    <title></title> 
    <meta name="viewport" content="width=device-width, initial-scale=1.0"> 

    <link rel="shortcut icon" href="http://localhost/images/fav.ico"> 
    <link rel="stylesheet" href="http://localhost/bootstrap.css"> 
    <link rel="stylesheet" href="http://localhost/style.css"> 

    <!--[if lt IE 9]> 
    <script src="http://localhost/js/html5shiv.js"></script> 
    <script src="http://localhost/js/respond.js"></script> 
    <![endif]--> 


    <link rel="alternate" type="application/rss+xml" title=" &raquo; Kanał z wpisami" href="http://localhost/feed/" /> 
<link rel="alternate" type="application/rss+xml" title=" &raquo; Kanał z komentarzami" href="http://localhost/comments/feed/" /> 
<link rel='stylesheet' id='contact-form-7-css' href='http://localhost/wp-content/plugins/contact-form-7/includes/css/styles.css?ver=3.2' type='text/css' media='all' /> 
<script type='text/javascript' src='http://localhost/wp-includes/js/jquery/jquery.js?ver=1.8.3'></script> 
<style type="text/css"> 
sup { 
    vertical-align: 60%; 
    font-size: 75%; 
    line-height: 100%; 
} 
sub { 
    vertical-align: -10%; 
    font-size: 75%; 
    line-height: 100%; 
} 
.amp { 
    font-family: Baskerville, "Goudy Old Style", "Palatino", "Book Antiqua", "Warnock Pro", serif; 
    font-weight: normal; 
    font-style: italic; 
    font-size: 1.1em; 
    line-height: 1em; 
} 
.caps { 
    font-size: 90%; 
} 
.dquo { 
    margin-left:-.40em; 
} 
.quo { 
    margin-left:-.2em; 
} 
/* because formatting .numbers should consider your current font settings, we will not style it here */ 
</style> 
    <style type="text/css">.recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;}</style> 
</head> 

<body class="home blog">  
    <div id="wrap" class="container"> 
     <!-- #header --> 
     <header id="header" class="span12"> 
      <div class="navbar"> 
       <div class="navbar-inner"> 
        <div class="container"> 
         <h1 class="brand"><a href="http://localhost"></a></h1> 
         <div class="nav-collapse collapse hidden-mobile"> 
          <ul class="nav pull-right"> 
           <li><a href="#about" title="O mnie">O mnie</a></li> 
           <li><a href="#showcase" title="Realizacje">Realizacje</a></li> 
           <li><a href="#contact" title="FAQ/Kontakt">FAQ i kontakt</a></li> 
          </ul> 
         </div> 
        </div> 
       </div> 
      </div> 
     </header> 
     <!-- /#header --> 


<!-- #slider --> 
<section id="slider" class="hidden-phone carousel slide"> 
    <div> 
     <article class="item"></article> 
     <article class="item"></article> 
    </div> 
</section> 


    </div> 

    <script type='text/javascript' src='http://localhost/wp-content/plugins/contact-form-7/includes/js/jquery.form.js?ver=3.09'></script> 
<script type='text/javascript'> 
/* <![CDATA[ */ 
var _wpcf7 = {"loaderUrl":"http:\/\/192.168.1.2\/\/wp-content\/plugins\/contact-form-7\/images\/ajax-loader.gif","sending":"Wysy\u0142anie..."}; 
/* ]]> */ 
</script> 
<script type='text/javascript' src='http://localhost/wp-content/plugins/contact-form-7/includes/js/scripts.js?ver=3.2'></script> 
<script src="http://localhost/js/jquery.js"></script> 
<script src="http://localhost/js/bootstrap.min.js"></script> 
<script src="http://localhost/js/plugins.js"></script> 
<script src="http://localhost/js/script.js"></script> 

<!-- 

<script> 

    var _gaq = _gaq || []; 
    _gaq.push(['_setAccount', 'UA-XXXXXX-XX']); 
    _gaq.push(['_trackPageview']); 

    (function() { 
    var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; 
    ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; 
    var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); 
    })(); 

</script> 
--> 

</body> 

</html> 

我也包括引導的兩個CSS文件(合併成一個 - 第一和引導,未來responsive.css bootstrap.css)和bootstrap.js底部。但我有一個非常奇怪的問題(自從我使用Twitter Bootstrap以來第一次) - 在我的手機上(華爲Ascend)機身太寬(不管方向如何)。它好像有一些填充 - 所以我刪除了body的填充,但它沒有幫助。問題是可見的,即使我刪除我的CSS並保留僅Bootstrap的。

+0

你看到Bootstrap的演示頁面是否與你的手機一樣? http://twitter.github.com/bootstrap/examples/fluid.html – 2013-03-18 21:03:56

+0

不 - 這就是問題所在。我檢查了另外兩款手機(三星,Galaxy 551和Galaxy II),它們都是一樣的。 – 2013-03-18 21:07:14

+0

嘗試在你的標題標籤上刪除class =「span12」...你不在那裏,所以也許這是打破它? – 2013-03-19 09:17:52

回答

0

設置已

.container { width: 100% !important } 

幫助。我仍然不知道爲什麼會發生這種情況。

2

這是一個非常糟糕的修復。嘗試改變.container.container-fluid並看看會發生什麼......

設置寬度爲100%會給你其他頭痛的路線......

+0

這是迄今爲止唯一的工作。如果你有任何想法如何避免設置'容器'爲'100%',我很樂意聽到它(真的,沒有sarcarm :))。 – 2013-03-21 11:44:36

3

引導程序的版本並沒有在規定的問題,雖然它是在v3.0發佈之前發佈。

在任何情況下,如果有人碰巧遇到這個話題,並且與v3.x有同樣的問題,這就是我所做的。 YMMV取決於你.container的div與否直接上門低於<體>或不..

/* Fix for viewport being too wide below smallest breakpoint */ 
@media (max-width: 767px) { 
    body > .container { overflow: hidden; } /* fix */ 
    body > .container > * { overflow: visible; } /* reset back to normal */ 
} 
2

嘗試改變.container.container-fluid並添加<div class="row-fluid">作爲.container-fluid直接孩子。