我应该在哪里引导我的网站?

时间:2023-01-13 23:02:00

I want my site to be fluid/responsive to whatever device the user has; I reckon more often than not it will be a cell "phone," but I am developing on a laptop, so there's a mismatch between what I see at design time and what most users will see. Of course, I can run emulators/simulators, etc. But my point is that I want the site to automatically adjust to the size/aspect ratio/orientation the device at any given moment. From what I've read, the easiest way to accomplish this is to leverage Twitter Bootstraps capabilities by referencing their CSS file and adding a few class declarations to various tags in my html. I'm wondering just where I need to add these.

我希望我的网站能够流畅/响应用户拥有的任何设备;我估计它往往是一个单元格“手机”,但我在笔记本电脑上开发,所以我在设计时看到的与大多数用户看到的不匹配。当然,我可以运行模拟器/模拟器等。但我的观点是,我希望网站在任何给定时刻自动调整设备的大小/宽高比/方向。根据我的阅读,最简单的方法是通过引用他们的CSS文件并在我的html中为各种标签添加一些类声明来利用Twitter Bootstraps功能。我想知道我需要在哪里添加这些。

I've added the bootstrap css:

我添加了bootstrap css:

<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.1/css/bootstrap-combined.no-icons.min.css" rel="stylesheet">

My _SiteLayout.cshtml (Razor 2 webiste) file came structured this way (showing just the body, head decapitated):

我的_SiteLayout.cshtml(Razor 2 webiste)文件以这种方式结构化(仅显示正文,头部被斩首):

<body>
    <div id="fb-root"></div>
    <header>
        <div class="content-wrapper">
            <div class="float-left">
                <p class="site-title">
                </p>
            </div>
            <div class="float-right">
            </div>
        </div>
    </header>
    <div id="body" >
        @RenderSection("featured", required: false)
        <section class="content-wrapper main-content clear-fix">
            @RenderBody()
        </section>
    </div>
    <footer>
        <div class="content-wrapper">
            <div class="float-left">
                <p>
                </p>
            </div>
        </div>
    </footer>
</body>

So it uses "content-wrapper" on the outher divs and then floats inner tags left and right. Does this obviate the need for Twitter Bootstrap? Is the same sort of responsive design baked into this Razor 2 structure already?

所以它在外部div上使用“content-wrapper”,然后左右浮动内部标签。这是否消除了对Twitter Bootstrap的需求?这种Razor 2结构已经采用了相同的响应式设计吗?

If not, in which tags should I put the Twitter Bootstrap class declarations?

如果没有,我应该在哪些标签中放置Twitter Bootstrap类声明?

Should I add class="row-fluid" to some of these tags and, if so, which ones?

我应该为其中一些标签添加class =“row-fluid”,如果是,那么哪些?

1 个解决方案

#1


2  

The basic fluid grid scaffolding of Twitter Bootstrap is laid out as .container-fluid > .row-fluid > .span#. Spans within .row-fluid use percentage widths conducive of layouts consisting of elements that add up to 12: .span1, .span2, .span3 etc..

Twitter Bootstrap的基本流体网格支架布局为.container-fluid> .row-fluid> .span#。 .row-fluid中的跨度使用百分比宽度,有助于布局由多达12的元素组成:.span1,.span2,.span3等。

Span classes are already set to float:left which can be overridden by adding .pull-right to float:right elements.

Span类已经设置为float:left,可以通过将.pull-right添加到float:right元素来覆盖它。

So Bootstrap implementation with your layout could look something like:

所以你的布局的Bootstrap实现可能看起来像:

<body>
    <div id="fb-root"></div>
    <header class="container-fluid">
        <div class="row-fluid content-wrapper">
            <div class="span6">
                <p class="site-title">
                </p>
            </div>
            <div class="span6 pull-right">
            </div>
        </div>
    </header>
    <div class="container-fluid" id="body">
        @RenderSection("featured", required: false)
        <section class="row-fluid content-wrapper main-content clear-fix">
            @RenderBody()
        </section>
    </div>
    <footer class="container-fluid">
        <div class="row-fluid content-wrapper">
            <div class="span12">
                <p>
                </p>
            </div>
        </div>
    </footer>
</body>

Take a look at http://twitter.github.io/bootstrap/scaffolding.html#fluidGridSystem

看看http://twitter.github.io/bootstrap/scaffolding.html#fluidGridSystem

#1


2  

The basic fluid grid scaffolding of Twitter Bootstrap is laid out as .container-fluid > .row-fluid > .span#. Spans within .row-fluid use percentage widths conducive of layouts consisting of elements that add up to 12: .span1, .span2, .span3 etc..

Twitter Bootstrap的基本流体网格支架布局为.container-fluid> .row-fluid> .span#。 .row-fluid中的跨度使用百分比宽度,有助于布局由多达12的元素组成:.span1,.span2,.span3等。

Span classes are already set to float:left which can be overridden by adding .pull-right to float:right elements.

Span类已经设置为float:left,可以通过将.pull-right添加到float:right元素来覆盖它。

So Bootstrap implementation with your layout could look something like:

所以你的布局的Bootstrap实现可能看起来像:

<body>
    <div id="fb-root"></div>
    <header class="container-fluid">
        <div class="row-fluid content-wrapper">
            <div class="span6">
                <p class="site-title">
                </p>
            </div>
            <div class="span6 pull-right">
            </div>
        </div>
    </header>
    <div class="container-fluid" id="body">
        @RenderSection("featured", required: false)
        <section class="row-fluid content-wrapper main-content clear-fix">
            @RenderBody()
        </section>
    </div>
    <footer class="container-fluid">
        <div class="row-fluid content-wrapper">
            <div class="span12">
                <p>
                </p>
            </div>
        </div>
    </footer>
</body>

Take a look at http://twitter.github.io/bootstrap/scaffolding.html#fluidGridSystem

看看http://twitter.github.io/bootstrap/scaffolding.html#fluidGridSystem