Bootstrap中.row类的左右边距为负

时间:2017-12-13 05:13:47

标签: css twitter-bootstrap

出于好奇,为什么bootstrap使用-15px左右margin来取消15px上的padding左右.container.container-fluid课程 为什么要设置填充,然后在孩子的负边距上取消填充?

2 个答案:

答案 0 :(得分:1)

正如Official Bootstrap Website所说:

  

是列的包装器。每列都有水平txtPassword.Properties.UseSystemPasswordChar = true; txtHostname.Text = Properties.Settings.Default.server; txtUsername.Text = Properties.Settings.Default.user; txtPassword.Text = Properties.Settings.Default.pass; txtDBPath.Text = Properties.Settings.Default.dbpath; void Testdbconn() { try { var testInMemUnicode = String.Format("DataSource={0};Database={1};User ID={2};Password={3}; Charset=NONE;", txtHostname.Text, txtHostname.Text + ":" + txtDBPath.Text.Trim(), txtUsername.Text, txtPassword.Text); var testConnParam = new FbConnection(testInMemUnicode); testConnParam.Open(); XtraMessageBox.Show(@"Connection to the server is successful.", @"Data Server Test", MessageBoxButtons.OK, MessageBoxIcon.Information); } catch (Exception errorCode) { XtraMessageBox.Show(@"Error in connection: " + errorCode.Message, @"Server Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } class ClsConnection { public static string FirebirdSQL = String.Format( "DataSource={0}; Database={1}; User ID={2}; Password={3}; Charset=NONE; Port=3050; Dialect=3;" + "Connection lifetime=15; Pooling=true; MinPoolSize=0; MaxPoolSize=2000000; Packet Size=8192; ServerType=0", Properties.Settings.Default.server, Properties.Settings.Default.db + ":" + Properties.Settings.Default.dbpath, Properties.Settings.Default.user, Properties.Settings.Default.pass); private static readonly string FirebirdService = FirebirdSQL; /// <summary> /// /// </summary> public static FbConnection Firebird = new FbConnection(FirebirdService); /// <summary> /// /// </summary> public void Openconnection() { if (Firebird.State == System.Data.ConnectionState.Open) { Firebird.Close(); } Firebird.Open(); } /// <summary> /// /// </summary> public void Closeconnection() { Firebird.Close(); } } 称为装订线),用于控制它们之间的空间。然后,在padding为负的行上对此padding进行抵消。这样,列中的所有内容都在左侧视觉对齐。

答案 1 :(得分:1)

行上的负边距避免了由于第一列填充而留下的空白。在它缺席的情况下,整个布局看起来有点缩进。