如何将Bootstrap的容器div调整为离开左视口边缘100像素? [英] How to adjust Bootstrap's container div to 100px off the left viewport edge?

查看:45
本文介绍了如何将Bootstrap的容器div调整为离开左视口边缘100像素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Twitter Bootstrap固定布局,其中容器 div 具有:

I'm using the Twitter Bootstrap fixed layout where the container div has:

margin-left: auto;
margin-right: auto;

因此它始终位于中心.

我要做的是放置容器,以使浏览器左边界和容器之间有100px的间隙.当窗口变小时,我希望容器移至窗口的边框.

What I want to do is position the container so that there is a 100px gap between the left browser window border and the container. When the window gets smaller I want the container move to border of the window.

我该如何实现?

推荐答案

好的,这就是我所做的:

Ok here's what I did:

.container {
  padding-left: 10px;
  padding-right: 250px;
}

不能完全给我我想要的结果,但是非常接近.我的第一个span 3是侧边栏,最后一个span9是主要内容区域.现在,主要内容区域始终处于居中位置,并且侧边栏位于其旁边,并且与窗口边框之间的最小距离为10px.

doesn't give me exactly the result I was looking for, but pretty close. My first span 3 is a sidebar and the last span9 main content area. The main content area is now always centered and the sidebar next to it and has a minimum gap of 10px to the window border.

这篇关于如何将Bootstrap的容器div调整为离开左视口边缘100像素?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆