简体   繁体   English

引导程序-对齐问题

[英]Bootstrap - alignment issues

I have a comics website that I'm complete redoing- Hitting Trees with Sticks . 我有一个漫画网站,我已完成重做- 木棍打树

I'm trying to go from that current horrible 1990's layout to this layout (colors and fonts are just placeholders atm)... 我正试图从当前可怕的1990年版式过渡到这种版式(颜色和字体只是atm的占位符)...

在此处输入图片说明

And here's how I think the CSS divs would be laid out for it: 这就是我认为CSS div的布局方式:

在此处输入图片说明

Anyway, 无论如何,

I'm trying to have the search bar to the far right be able to expand down once something is searched. 我正在尝试使搜索栏最右边能够在搜索到某些内容后向下扩展。 Right now I pushes down the rows beneath it. 现在,我将其下面的行向下推。 It should be independent of those rows. 它应该独立于那些行。 Basically, my main goal is to have the Search bar be inline with the top two boxes (Highlighted Comic and Latest Artwork), but also not push down the outputted comics below... it sort of just need to be an independent column . 基本上,我的主要目标是使搜索栏与顶部的两个框(突出显示的漫画和最新艺术品)保持一致,但也不要向下推下方输出的漫画...它只是需要一个独立的列

    <div class="row-fluid show-grid">
    <div class="span6 offset2">
        <img src="./images/highlighted comic.png"/>
        <img src="./images/latest artwork.png"/>
    </div>
    <div class="span2">
        <?php include 'include/search_field.php'; ?>
    </div>
</div>

//Where the comics are outputted:
<div class="row-fluid show-grid">   
    <div class="span6 offset2">
        <div class="allimages">
            <div class="row-fluid show-grid">   
                <div class="span6">
                    <h3>latest</h3>
                    <?php include 'scripts/paging.php'; ?>
                </div>
                <div class="span2">
                    <h3>hot</h3>    
                    <?php echo hot(7, $site); ?>
                </div>
            </div>
        </div>
    </div>
</div>

And I can't just move <?php include 'include/search_field.php'; ?> 而且我不能只移动<?php include 'include/search_field.php'; ?> <?php include 'include/search_field.php'; ?> to below where the comics are outputted (I know this would solve the problem of the expanding search pushing down the the comics... but the Search box needs to be in alignment with the Highlighted Comic and Latest Artwork boxes) <?php include 'include/search_field.php'; ?>到下面的漫画输出位置 (我知道这将解决扩大搜索范围以压低漫画的问题……但是“搜索”框需要与“突出显示的漫画”和“最新艺术品”框对齐)


This is what it looks like when I search: 这是我搜索时的样子:

Pre-search: 预搜索:

在此处输入图片说明

When you search for something: 搜索内容时:

在此处输入图片说明

Any thoughts? 有什么想法吗?

Thanks! 谢谢!


EDIT: I am unable to push the search box flush against the left side boxes 编辑:我无法将搜索框推向左侧框齐平

    <div class="row-fluid">
    <div class="span8 offset2">
        <div class="row-fluid">
            <div class="span5"><img src="./images/highlighted comic.png"/></div>
            <div class="span4"><img src="./images/latest artwork.png"/></div>
        </div>
        <div class="row-fluid">
            <div class="comicDisplay">
                <div class="well">
                    <div class="row-fluid"> 
                        <div class="span7"><h3>Latest</h3>  <?php include 'scripts/paging.php'; ?></div>
                        <div class="span2"><h3>Hot</h3> <?php echo hot(7, $site); ?></div>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div class="span2">
        <?php include 'include/search_field.php'; ?>
    </div>
</div><!--End top row fluid-->

在此处输入图片说明

independent column 独立专栏

That's it! 而已!

Check this out (from http://jsfiddle.net/Q7k7W/3/ ): 检查一下(从http://jsfiddle.net/Q7k7W/3/ ):

<link rel="stylesheet" type="text/css" href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.2.2/css/bootstrap-combined.min.css">
<style type="text/css">
.b {
    border: 1px solid #ccc;
    padding: 10px;
}
</style>

<div class="container-fluid" style="margin-top: 20px;">
    <div class="row-fluid">
        <!-- The main content column placed on the left (for appropriate viewports/browser widths) -->
        <div class="span9 b">
            <div class="row-fluid">
                <div class="span8 b">Highlighted Comic</div>
                <div class="span4 b">Latest Artwork</div>
            </div>
            <div class="row-fluid">
                <div class="span8 b">Latest</div>
                <div class="span4 b">Hot</div>
            </div>
        </div>
        <!-- 
        The search/sidebar column placed on the right.
        The height of this column shouldn't affect the height of the left column.
        -->
        <div class="span3 b" style="height: 300px;">
            Search
        </div>
    </div>
</div>

You would create two divs for the two columns (one for the left-hand-side main content and the other for the search/sidebar on the right). 您将为两列创建两个div(一个用于左侧主要内容,另一个用于右侧的搜索/边栏)。 In the jsfiddle example above, the divs are being nested (see 'Fluid nesting' section of the Bootstrap scaffolding docs ). 在上面的jsfiddle示例中,div是嵌套的(请参见Bootstrap scaffolding docs的 “ Fluid nesting”部分)。

And I can't just move to below where the comics are outputted (I know this would solve the problem of the expanding search pushing down the the comics... but the Search box needs to be in alignment with the Highlighted Comic and Latest Artwork boxes) 而且我不能只移动到输出漫画的地方(我知道这将解决扩大搜索范围以压低漫画的问题……但是搜索框需要与突出显示的漫画和最新作品保持一致盒子)

You should still be able to keep the alignment if you move the search to a different column (as in the example above). 如果将搜索移到另一列(如上例所示),您仍然应该能够保持对齐。

The reason why the search column is pushing down the comics is because it is laid out in the same row as the highlighted comic and the latest artwork. 搜索列压低漫画的原因是因为它与突出显示的漫画和最新作品位于同一行 The way it's currently laid is like so . 当前的放置方式就像这样 You need to lay it out as you describe in your second image : a left block and right block (just as in the jsfiddle example above). 您需要按照第二个图像中的描述进行布局:一个左块和一个右块(就像上面的jsfiddle示例一样)。

You might find these two resources helpful as well: 您可能会发现以下两种资源也很有帮助:

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM