2012-07-10 92 views
0

我正在使用Twitter Boostrap以及随附的网格系统。 对于我的#stories div,我想将它移动到页面的右侧,以便它垂直平行于“欢迎”div。无法获取内容到页面最右侧

我已经按照Boostrap参考(脚手架部分)中的嵌套规则,根据他们的指南展示了我的代码,但无法获得故事div的内容,以显示为右侧的列。

有人可以告诉我我可能会做错什么吗?

下面的代码,但也是一个链接在底部的整个页面。

<div class="row"> 



     <!-- welcome container --> 
     <div class="span8" id="welcome"> 
      <h1>Storify</h1> 
      <div id="StoryActions"> 

      <div> 

       <a href="#" class="btn btn-success .btn-large" id="BtnCreateStory"> 
        <div id="NewStoryBtn"> 
         <span id="create">CREATE</span><p id="newstory">New Story</p> 
        </div> 
       </a> 



       <a href="#" class="btn" id="BtnJoin"> 
        <div id="JoinStoryBtn"> 
         <span id="create">JOIN</span><p id="newstory">Existing Story</p> 
        </div> 
       </a> 

       <p id="registration">no registration required</p> 



       <div id="StoryDescription"> 
       <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p> 
       <p>Storify is a <strong>fun</strong>, group <strong>writing game</strong> 
       taking inspiration from the story writing game that you may have played at a party or at school with friends.</p> 

       <p>Each person writes a random sentence to form part of a story.</p> 

       <p>Once the story is complete, one person reads out the whole story, and usually everyone breaks into laughter.</p> 
       <p>Storify is great for playing with your Internet friends or Co-workers.</p> 
       </div> 

      </div> 

      </div> 

    <div class="row"> 

     <div class="span6"> 

       <!-- Running Stories --> 
       <div class="span3">&nbsp;</div> 

       <div class="span3"> 
        <div id="stories"> 
        I want to write a really long story here and see how far it goes down the path 
        </div> 
       </div> 

     </div> 


    </div> 

回答

2

引导程序网格系统利用12个cloumns,这意味着,在每行您设计,内部行的列的总和在最上层应等于12或更小。嵌套行中列的总数应该等于嵌套行的列的大小。

您的示例的简化方案是这样的:

<div class="row"> 
    <!-- welcome container --> 
    <div class="span8" id="welcome"> 
    ... 
    <div class="row"> 
    <div class="span6"> 
    <!-- Running Stories --> 
     <div class="span3">&nbsp;</div> 

     <div class="span3"> 
     <div id="stories"> 
      I want to write a really long story here and see how far it goes down the path 
     </div> 
     </div> 
    </div> 
</div> 

有几个错误。

  1. span8 div未正确关闭。而不是它的结束标记,有一个多余的 div。
  2. 最高级别的列总和为14(span8 + span6),这太多了。
  3. 两个嵌套列span3未在另一个中关闭。

这里是固定的版本,其中,I具有降低的右列span4所以总和将等于12同样我已经减少了列嵌套的尺寸。

<div class="container"> 

    <div class="row"> 

     <!-- welcome container --> 
     <div class="span8" id="welcome"> 
      <h1>Storify</h1> 
      <div id="StoryActions"> 

      <div> 

       <a href="#" class="btn btn-success .btn-large" id="BtnCreateStory"> 
        <div id="NewStoryBtn"> 
         <span id="create">CREATE</span><p id="newstory">New Story</p> 
        </div> 
       </a> 



       <a href="#" class="btn" id="BtnJoin"> 
        <div id="JoinStoryBtn"> 
         <span id="create">JOIN</span><p id="newstory">Existing Story</p> 
        </div> 
       </a> 

       <p id="registration">no registration required</p> 



       <div id="StoryDescription"> 
       <p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p> 
       <p>Storify is a <strong>fun</strong>, group <strong>writing game</strong> 
       taking inspiration from the story writing game that you may have played at a party or at school with friends.</p> 

       <p>Each person writes a random sentence to form part of a story.</p> 

       <p>Once the story is complete, one person reads out the whole story, and usually everyone breaks into laughter.</p> 
       <p>Storify is great for playing with your Internet friends or Co-workers.</p> 
       </div> 

      </div> 

      </div> 

     </div> 

     <div class="span4"> 

      <div class="row"> 
       <!-- Running Stories --> 
       <div class="span2">&nbsp;</div> 

       <div class="span2"> 
        <div id="stories"> 
        I want to write a really long story here and see how far it goes down the path 
        </div> 
       </div> 
      </div> 
     </div> 

</div> 
+0

谢谢你的回答。我明白,列应该加起来到上面的总数,但我认为只适用于添加另一个“行”的时候? 我也重新检查我自己的代码(notepad ++),但似乎我的span8和行div正确关闭(而不是争论)? 无论如何,我粘贴你的代码确切(你可以看到这个网址)和故事的列仍然没有出现在右边? https://dl.dropbox.com/u/3417415/Storify/mockups/screen1debug.html – 2012-07-11 11:03:41

+1

通过在Firebug中删除和编辑HTML节点的尝试和错误,我发现问题的根源在于自定义样式定义。特别是'#欢迎{margin-left:10%;}'打破了两列的布局。尝试用'margin-left:0'代替,在我的浏览器中,这可以解决问题。但是,也可能存在其他风格冲突。祝你好运。 – 2012-07-11 11:29:11

+0

我的歉意。你其实是正确的。这是我添加的左边缘破坏了东西,然后我又通过了divs,发现我没有正确关闭。对您造成的不便深表歉意,但非常感谢您花时间帮助我。 – 2012-07-11 12:54:54