简体   繁体   English

CSS / Javascript Spinner将文本居中对齐

[英]CSS / Javascript Spinner align text middle

I followed a guide on how to add a spinner , it can be found here: 我遵循了有关如何添加微调器的指南,可以在此处找到它:

http://blog.tkglaser.net/2012/02/waiting-spinner-for-long-running-form.html http://blog.tkglaser.net/2012/02/waiting-spinner-for-long-running-form.html

Everything works great while on the pc but when I'm on a handdevice the text, (searching things..), doesn't stay in the middle, (the spinner does). 在PC上,一切工作都很好,但是当我在手持设备上时,文本(搜索内容)不会停留在中间(微调器会)。

Css for the text: CSS的文字:

#loadingspinner {
    cursor: default;
    display: table-cell;
    vertical-align: middle;
    width: 100%;
    text-align: center;
    font-size: larger;
    padding-top: 80px;
    user-select: none;
    color: black;
}

How come it centers fine when surfing on a pc but not from a mobile device? 在PC上浏览而不是在移动设备上浏览时,它如何居中?

Thanks.. //css noob 谢谢.. // css noob

I noticed that the parent div that contained the spinner had position:fixed; 我注意到包含微调框的父div具有position:fixed; so instead of using vertical-align: middle; 所以不要使用vertical-align:middle; I used: 我用了:

position: fixed; 位置:固定;

top: 50%; 最高:50%;

and some padding to get it down abit. 和一些填充以使它降下来。

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

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