简体   繁体   English

CSS / Bootstrap样式问题

[英]CSS/Bootstrap styling issues

I'm trying to configure a content section of my site but I'm having trouble with the bootstrap grid system. 我正在尝试配置网站的内容部分,但引导网格系统出现问题。

See my bootly example: http://www.bootply.com/121304 参见我的引导示例: http : //www.bootply.com/121304

In my website design, i use a column-lg-3 and a column-lg-9 within a row class. 在我的网站设计中,我在行类中使用column-lg-3和column-lg-9。 To serve as a Help section and Content Area. 用作帮助部分和内容区域。 In the content area on the majority of my pages, i use the whole column-lg-9. 在我大部分页面的内容区域中,我使用整列lg-9。 However in a few of my pages, i use horizontally aligned forms, such as login page (dont know ajax to get login modal working..) and input forms. 但是,在我的一些页面中,我使用水平对齐的表单,例如登录页面(不知道ajax可以使登录模式正常工作..)和输入表单。 On the pages with the input forms i wish to keep the column-lg-9 at its proper size, but have the login/input fields centered into it. 我希望在具有输入表单的页面上将lg-9列保持其适当的大小,但将登录/输入字段居中放置在其中。

I have attempted to do this with a small amount of success, after reading some of the bootstrap documentation, by adding 3 column-lg-3's inside of the column-lg-9. 在阅读了一些引导文档之后,我尝试通过在column-lg-9的内部添加3个column-lg-3来取得一定的成功。 As you can see in my bootply example, this has not fully centered the login form inside of the larger column, and ideally I would also like to center this form inside its parent column. 正如您在我的bootply示例中看到的那样,这并未将登录表单完全置于较大列的内部居中,理想情况下,我也希望将此表单置于其父列内部。

Create a new class eg .col-centered and apply it to whatever column you want centered eg 创建一个新类,例如.col-centered并将其应用于您想居中的任何列,例如

<div class="col-lg-3 col-centered">

CSS CSS

.col-centered{
    float: none;
    margin: 0 auto;
}

Also, by looking at your code, it seems like you are trying to use empty <div class="col-lg-3"></div> to offset. 另外,通过查看您的代码,似乎您正在尝试使用空的<div class="col-lg-3"></div>进行偏移。 That is incorrect. 那是不对的。 You don't use empty divs to achieve this. 您不要使用空的divs来实现此目的。

You use offset classes such as <div class="col-lg-3 col-lg-offset-6">...</div> Documentation 您使用偏移类,例如<div class="col-lg-3 col-lg-offset-6">...</div> 文档

您只需要删除float: left从受影响的DIVS的CSS中删除

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

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