Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/476.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
Javascript 垂直对齐按钮在屏幕上没有滚动_Javascript_Html_Css_Ionic Framework - Fatal编程技术网

Javascript 垂直对齐按钮在屏幕上没有滚动

Javascript 垂直对齐按钮在屏幕上没有滚动,javascript,html,css,ionic-framework,Javascript,Html,Css,Ionic Framework,我在这里按照这个例子创建了没有滚动的垂直按钮 CSS .scroll-content { display: -webkit-box; display: -moz-box; display: -ms-flexbox; display: -webkit-flex; display: flex; -webkit-box-direction: normal; -moz-box-direction: normal; -webkit-bo

我在这里按照这个例子创建了没有滚动的垂直按钮

CSS

  .scroll-content {
    display: -webkit-box;
    display: -moz-box;
    display: -ms-flexbox;
    display: -webkit-flex;
    display: flex;
    -webkit-box-direction: normal;
    -moz-box-direction: normal;
    -webkit-box-orient: horizontal;
    -moz-box-orient: horizontal;
    -webkit-flex-direction: row;
    -ms-flex-direction: row;
    flex-direction: row;
    -webkit-flex-wrap: nowrap;
    -ms-flex-wrap: nowrap;
    flex-wrap: nowrap;
    -webkit-box-pack: center;
    -moz-box-pack: center;
    -webkit-justify-content: center;
    -ms-flex-pack: center;
    justify-content: center;
    -webkit-align-content: stretch;
    -ms-flex-line-pack: stretch;
    align-content: stretch;
    -webkit-box-align: center;
    -moz-box-align: center;
    -webkit-align-items: center;
    -ms-flex-align: center;
    align-items: center;
  }
HTML

  <ion-content has-header="true" padding="true">
    <div class="row row-center">
      <div class="col col-center">
        You need to login
      </div>
    </div>
    <div class="row">
      <div class="col">
        <button class="button button-block button-positive">
          Go to Login
        </button>
      </div>
    </div>
  </ion-content>

您可以使用display:table和在父元素上设置高度/宽度来简化css

.scroll-content {
  display: table !important;
  width: 100% !important;
  height: 100% !important;
}
.scroll {
  display: table-cell;
  vertical-align: middle;
  text-align: center;
}

您可以使用display:table和在父元素上设置高度/宽度来简化css

.scroll-content {
  display: table !important;
  width: 100% !important;
  height: 100% !important;
}
.scroll {
  display: table-cell;
  vertical-align: middle;
  text-align: center;
}

我知道这个话题很老了。。。 但对于未来,当人们研究这个(像我一样)的时候,这对我起了作用: 如果您试图在一个页面中完成此操作,请将此添加到页面中

<style>
.scroll-content{
  display: table !important;
  width: 100% !important;
  height: 100% !important;
}
.scroll {
  display: table-cell;
  vertical-align: middle;
  text-align: center;
}
</style>

.滚动内容{
显示:表!重要;
宽度:100%!重要;
身高:100%!重要;
}
.卷轴{
显示:表格单元格;
垂直对齐:中间对齐;
文本对齐:居中;
}
@惠普


我猜你的问题是上面的这个div,它们改变了div的位置,比如你先居中,然后这个col再居中,在数学上你占到了页面的50%,比左边的50%要低50%多(总共75%),其他的,都改变了

<div class="list">

  <label class="item item-input">
    <span class="input-label">Username</span>
    <input type="text">
  </label>
</div>

用户名

我知道这个话题很老了。。。 但对于未来,当人们研究这个(像我一样)的时候,这对我起了作用: 如果您试图在一个页面中完成此操作,请将此添加到页面中

<style>
.scroll-content{
  display: table !important;
  width: 100% !important;
  height: 100% !important;
}
.scroll {
  display: table-cell;
  vertical-align: middle;
  text-align: center;
}
</style>

.滚动内容{
显示:表!重要;
宽度:100%!重要;
身高:100%!重要;
}
.卷轴{
显示:表格单元格;
垂直对齐:中间对齐;
文本对齐:居中;
}
@惠普


我猜你的问题是上面的这个div,它们改变了div的位置,比如你先居中,然后这个col再居中,在数学上你占到了页面的50%,比左边的50%要低50%多(总共75%),其他的,都改变了

<div class="list">

  <label class="item item-input">
    <span class="input-label">Username</span>
    <input type="text">
  </label>
</div>

用户名