Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/81.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/37.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Html Bootstrap 3处理xs和sm之间的差异_Html_Css_Twitter Bootstrap_Twitter Bootstrap 3 - Fatal编程技术网

Html Bootstrap 3处理xs和sm之间的差异

Html Bootstrap 3处理xs和sm之间的差异,html,css,twitter-bootstrap,twitter-bootstrap-3,Html,Css,Twitter Bootstrap,Twitter Bootstrap 3,我将X列-*用于纵向移动设备,但天真地认为sm列-*用于横向移动设备,然而,根据第一个答案,事实并非如此 因此,我的问题是如何有效地将col结构用于景观手机 我的想法是: col-xs-12在垂直移动设备上 col-sm-6在横向移动上,因为它明显更宽 然而,因为sm不是我最初认为的那样,在不改变核心引导CSS的情况下,这是可能的吗 例如,如果我们看一个iphone6+,它的横向宽度是736px,这仍然在xs的范围内 因此,这个视口中的任何col-xs-12都看起来绝对巨大,这让事情看起来很糟糕

我将X列-*用于纵向移动设备,但天真地认为sm列-*用于横向移动设备,然而,根据第一个答案,事实并非如此

因此,我的问题是如何有效地将col结构用于景观手机

我的想法是:

col-xs-12在垂直移动设备上 col-sm-6在横向移动上,因为它明显更宽 然而,因为sm不是我最初认为的那样,在不改变核心引导CSS的情况下,这是可能的吗

例如,如果我们看一个iphone6+,它的横向宽度是736px,这仍然在xs的范围内

因此,这个视口中的任何col-xs-12都看起来绝对巨大,这让事情看起来很糟糕

理论上,我可以将sm断点更改为低于当前值768,但是有更好的方法吗

也许在xs和sm之间添加一个类

更新

我还从另一个问题中找到了这个片段,这是一个潜在的问题

@media only screen and (min-width: 480px) and (max-width: 767px) {
    .col-xsl-6{ width: 50%; }
}

最简单的方法是减少使用并更改sm断点:

@import "bootstrap.less";
@screen-sm-min: 736px;

您还可以更改相同的@screen sm min变量。

因此,考虑到其他人的建议,我决定按照建议创建xsl col类

下面是CSS

/* Specifally landscape phones */
@media only screen and (min-width: 480px) and (max-width: 767px) {

.col-xsl-1, .col-xsl-2, .col-xsl-3, .col-xsl-4, .col-xsl-5, .col-xsl-6, .col-xsl-7, .col-xsl-8, .col-xsl-9, .col-xsl-10, .col-xsl-11, .col-xsl-12 {
        float: left;
        position: relative;
        min-height: 1px;
        padding-right: 15px;
        padding-left: 15px;
  }
  .col-xsl-12 {
    width: 100%;
  }
  .col-xsl-11 {
    width: 91.66666667%;
  }
  .col-xsl-10 {
    width: 83.33333333%;
  }
  .col-xsl-9 {
    width: 75%;
  }
  .col-xsl-8 {
    width: 66.66666667%;
  }
  .col-xsl-7 {
    width: 58.33333333%;
  }
  .col-xsl-6 {
    width: 50%;
  }
  .col-xsl-5 {
    width: 41.66666667%;
  }
  .col-xsl-4 {
    width: 33.33333333%;
  }
  .col-xsl-3 {
    width: 25%;
  }
  .col-xsl-2 {
    width: 16.66666667%;
  }
  .col-xsl-1 {
    width: 8.33333333%;
  }
  .col-xsl-pull-12 {
    right: 100%;
  }
  .col-xsl-pull-11 {
    right: 91.66666667%;
  }
  .col-xsl-pull-10 {
    right: 83.33333333%;
  }
  .col-xsl-pull-9 {
    right: 75%;
  }
  .col-xsl-pull-8 {
    right: 66.66666667%;
  }
  .col-xsl-pull-7 {
    right: 58.33333333%;
  }
  .col-xsl-pull-6 {
    right: 50%;
  }
  .col-xsl-pull-5 {
    right: 41.66666667%;
  }
  .col-xsl-pull-4 {
    right: 33.33333333%;
  }
  .col-xsl-pull-3 {
    right: 25%;
  }
  .col-xsl-pull-2 {
    right: 16.66666667%;
  }
  .col-xsl-pull-1 {
    right: 8.33333333%;
  }
  .col-xsl-pull-0 {
    right: auto;
  }
  .col-xsl-push-12 {
    left: 100%;
  }
  .col-xsl-push-11 {
    left: 91.66666667%;
  }
  .col-xsl-push-10 {
    left: 83.33333333%;
  }
  .col-xsl-push-9 {
    left: 75%;
  }
  .col-xsl-push-8 {
    left: 66.66666667%;
  }
  .col-xsl-push-7 {
    left: 58.33333333%;
  }
  .col-xsl-push-6 {
    left: 50%;
  }
  .col-xsl-push-5 {
    left: 41.66666667%;
  }
  .col-xsl-push-4 {
    left: 33.33333333%;
  }
  .col-xsl-push-3 {
    left: 25%;
  }
  .col-xsl-push-2 {
    left: 16.66666667%;
  }
  .col-xsl-push-1 {
    left: 8.33333333%;
  }
  .col-xsl-push-0 {
    left: auto;
  }
  .col-xsl-offset-12 {
    margin-left: 100%;
  }
  .col-xsl-offset-11 {
    margin-left: 91.66666667%;
  }
  .col-xsl-offset-10 {
    margin-left: 83.33333333%;
  }
  .col-xsl-offset-9 {
    margin-left: 75%;
  }
  .col-xsl-offset-8 {
    margin-left: 66.66666667%;
  }
  .col-xsl-offset-7 {
    margin-left: 58.33333333%;
  }
  .col-xsl-offset-6 {
    margin-left: 50%;
  }
  .col-xsl-offset-5 {
    margin-left: 41.66666667%;
  }
  .col-xsl-offset-4 {
    margin-left: 33.33333333%;
  }
  .col-xsl-offset-3 {
    margin-left: 25%;
  }
  .col-xsl-offset-2 {
    margin-left: 16.66666667%;
  }
  .col-xsl-offset-1 {
    margin-left: 8.33333333%;
  }
  .col-xsl-offset-0 {
    margin-left: 0;
  }
}

诚然,等待Bootstrap 4或使用较少的CSS可能更容易,但如果您正在寻找一个简单的、只使用CSS的解决方案,那么这应该可以解决问题。

您考虑过迁移到BS-4吗?我已经考虑过了,但我还没有机会跳到Bootstrap 4的Alpha版本。考虑到这一点,我不太清楚每一个变化。如果它是我自己的项目,我会迁移,但不幸的是,它即将结束,我不认为其他开发人员会欣赏潜在的测试。考虑到我的情况,我觉得这是最合理的方法,但是我仍然坚持使用CSS,所以会在适当的时候更改它。。。我真的需要进入预处理CSS。