jquery - 从基本 HTML 和 CSS 转向 Bootstrap 或流体布局

标签 jquery html css twitter-bootstrap twitter-bootstrap-3

我不是网页设计师。我来自统计背景,目前我正在尝试简单地组建一个网站。我已经在简单使用的 html 和普通 css 中找到了我想要的布局结构来开始它。经过研究,我发现像 bootstrap 这样的框架具有非常好的外观和感觉,并且想朝着那个方向发展。我的问题是如何在 Bootstrap 中构建以下结构。

HTML 文件

<html>
<link rel="stylesheet" type="text/css" href="layout.css" media="screen" />
<div class="container">
    <div class="user_stats">
        User Statistics
    </div>
    <div class="hunt">
        suggestions
    </div>
    <div class="personal">
        personal
    </div>
</div>
</html>

.container {
    width:960px;
    margin:0 auto;
}

.user_stats, .personal, .hunt {
    background-color:#aaa;
    margin:0 0 5px 5px;
}

CSS 文件

.user_stats, .personal {
    width:400px;
    float:left;
}

.user_stats {
    height:200px;
}

.personal {
    height:300px;
}

.hunt {
    width:550px;
    height:505px;
    float:right;
}

个人和建议(在 css personal 和 hunt 中)我想为图像添加占位符,并希望这些框有滚动条。

这是我的代码的截图: how it looks like

最佳答案

基本上你的布局代码应该是这样的

<div class="container">
 <div class="col-md-5">
   <div class="row">User Statistics</div>
   <div class="row">Personal</div>
 </div>
 <div class="col-md-7">
   Suggestions
 </div>
</div>

当然,您需要链接到 bootstrap.css 以获取网格类。

要让每个 div 都有滚动条,请在所需的 div 上使用以下类

.scrolldiv {
height:550px;
overflow-x: hidden;
overflow-y: auto;
}

<div class="col-md-5">
 <div class="row scrolldiv">User Statistics</div>
 <div class="row scrolldiv">Personal</div>
</div>
<div class="col-md-7 scrolldiv">
 Suggestions
</div>

关于jquery - 从基本 HTML 和 CSS 转向 Bootstrap 或流体布局,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24657021/

相关文章:

javascript - 使用 Ajax、JavaScript 和 HTML 发布一些数据

css - Bootstrap 4 scss : how to mixin the bootstrap's pb-x pm-x values to custom class?

javascript - jquery if css height > Xpx 这样做

javascript - 使用模板文字通过 javascript 将值分配给 title 属性

javascript - 为什么我应该使用 JQuery Ajax 模板

javascript - JQUERY随鼠标移动移动背景

javascript ->= 和只是 > 之间有区别吗?

html - 居中并根据浏览器窗口大小排列的 CSS Div 框

javascript - 为什么我需要额外的屏幕点击来隐藏元素?

html - 文本框和按钮不对齐