【问题标题】:Where should I bootstraperize my web site?我应该在哪里引导我的网站?
【发布时间】:2013-05-05 19:40:24
【问题描述】:

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

我已经添加了引导 css:

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

我的 _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>

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

如果不是,我应该将 Twitter Bootstrap 类声明放在哪些标签中?

我应该在其中一些标签中添加 class="row-fluid" 吗?如果可以,添加哪些标签?

【问题讨论】:

    标签: asp.net css html razor twitter-bootstrap


    【解决方案1】:

    Twitter Bootstrap 的基本流体网格脚手架布局为.container-fluid &gt; .row-fluid &gt; .span#。在.row-fluid 内的跨度使用百分比宽度,有利于由加起来为 12 的元素组成的布局:.span1.span2.span3 等。

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

    因此,您的布局的 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>
    

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2020-08-11
      • 1970-01-01
      • 1970-01-01
      • 2022-01-24
      • 2019-07-11
      • 1970-01-01
      • 2020-09-30
      相关资源
      最近更新 更多