因此,我在互联网上找到了此加载屏幕,并对其进行了一些调整,但不确定如何缩小它。这是我的代码:
的CSS
body {
background-color: #90EE90;
}
#loading-wrapper {
position: fixed;
width: 100%;
height: 100%;
left: 0;
top: 0;
}
#loading-text {
display: block;
position: absolute;
top: 100%;
left: 100%;
color: #999;
width: 100px;
height: 30px;
margin: -7px 0 0 -45px;
text-align: center;
font-family: 'PT Sans Narrow', sans-serif;
font-size: 20px;
}
#loading-content {
display: block;
position: relative;
left: 50%;
top: 50%;
width: 170px;
height: 170px;
margin: -85px 0 0 -85px;
border: 3px solid #F00;
}
#loading-content:after {
content: "";
position: absolute;
border: 3px solid #0F0;
left: 15px;
right: 15px;
top: 15px;
bottom: 15px;
}
#loading-content:before {
content: "";
position: absolute;
border: 3px solid #00F;
left: 5px;
right: 5px;
top: 5px;
bottom: 5px;
}
#loading-content {
border: 3px solid transparent;
border-top-color: #20B2AA;
border-bottom-color: #20B2AA;
border-radius: 50%;
-webkit-animation: loader 3.5s linear infinite;
-moz-animation: loader 3.5s linear infinite;
-o-animation: loader 3.5s linear infinite;
animation: loader 3.5s linear infinite;
}
#loading-content:before {
border: 3px solid transparent;
border-top-color: #778899;
border-bottom-color: #778899;
border-radius: 50%;
-webkit-animation: loader 2.5s linear infinite;
-moz-animation: loader 2.5s linear infinite;
-o-animation: loader 2.5s linear infinite;
animation: loader 3s linear infinite;
}
#loading-content:after {
border: 3px solid transparent;
border-top-color: #84417C;
border-bottom-color: #84417C;
border-radius: 50%;
-webkit-animation: loader 1s linear infinite;
animation: loader 1s linear infinite;
-moz-animation: loader 1.5s linear infinite;
-o-animation: loader 1.5s linear infinite;
}
@-webkit-keyframes loaders {
0% {
-webkit-transform: rotate(0deg);
-ms-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
-ms-transform: rotate(360deg);
transform: rotate(360deg);
}
}
@keyframes loader {
0% {
-webkit-transform: rotate(0deg);
-ms-transform: rotate(0deg);
Transform: rotate (0deg);
}
100% {
-webkit-transform: rotate(360deg);
-ms-transform: rotate(360deg);
transform: rotate(360deg);
}
}
#content-wrapper {
color: #FFF;
position: fixed;
left: 0;
top: 20px;
width: 100%;
height: 100%;
}
#header
{
width: 800px;
margin: 0 auto;
text-align: center;
height: 100px;
background-color: #666;
}
#content
{
width: 800px;
height: 1000px;
margin: 0 auto;
text-align: center;
background-color: #888;
}
的HTML
<div id="loading-wrapper">
<div id="loading-text">LOADING</div>
<div id="loading-content"></div>
</div>
因此,我正在尝试使加载屏幕变小,以便它不会占用太多页面。提前致谢!
最佳答案
按比例更改width
中的height
,margin
和#loading-content
:
#loading-content {
width: 100px;
height: 100px;
margin: -50px 0 0 -50px;
}
演示片段:
body {
background-color: #90EE90;
}
#loading-wrapper {
position: fixed;
width: 100%;
height: 100%;
left: 0;
top: 0;
}
#loading-text {
display: block;
position: absolute;
top: 100%;
left: 100%;
color: #999;
width: 100px;
height: 30px;
margin: -7px 0 0 -45px;
text-align: center;
font-family: 'PT Sans Narrow', sans-serif;
font-size: 20px;
}
#loading-content {
display: block;
position: relative;
left: 50%;
top: 50%;
width: 100px;
height: 100px;
margin: -50px 0 0 -50px;
border: 3px solid #F00;
}
#loading-content:after {
content: "";
position: absolute;
border: 3px solid #0F0;
left: 15px;
right: 15px;
top: 15px;
bottom: 15px;
}
#loading-content:before {
content: "";
position: absolute;
border: 3px solid #00F;
left: 5px;
right: 5px;
top: 5px;
bottom: 5px;
}
#loading-content {
border: 3px solid transparent;
border-top-color: #20B2AA;
border-bottom-color: #20B2AA;
border-radius: 50%;
-webkit-animation: loader 3.5s linear infinite;
-moz-animation: loader 3.5s linear infinite;
-o-animation: loader 3.5s linear infinite;
animation: loader 3.5s linear infinite;
}
#loading-content:before {
border: 3px solid transparent;
border-top-color: #778899;
border-bottom-color: #778899;
border-radius: 50%;
-webkit-animation: loader 2.5s linear infinite;
-moz-animation: loader 2.5s linear infinite;
-o-animation: loader 2.5s linear infinite;
animation: loader 3s linear infinite;
}
#loading-content:after {
border: 3px solid transparent;
border-top-color: #84417C;
border-bottom-color: #84417C;
border-radius: 50%;
-webkit-animation: loader 1s linear infinite;
animation: loader 1s linear infinite;
-moz-animation: loader 1.5s linear infinite;
-o-animation: loader 1.5s linear infinite;
}
@-webkit-keyframes loaders {
0% {
-webkit-transform: rotate(0deg);
-ms-transform: rotate(0deg);
transform: rotate(0deg);
}
100% {
-webkit-transform: rotate(360deg);
-ms-transform: rotate(360deg);
transform: rotate(360deg);
}
}
@keyframes loader {
0% {
-webkit-transform: rotate(0deg);
-ms-transform: rotate(0deg);
Transform: rotate (0deg);
}
100% {
-webkit-transform: rotate(360deg);
-ms-transform: rotate(360deg);
transform: rotate(360deg);
}
}
#content-wrapper {
color: #FFF;
position: fixed;
left: 0;
top: 20px;
width: 100%;
height: 100%;
}
#header
{
width: 800px;
margin: 0 auto;
text-align: center;
height: 100px;
background-color: #666;
}
#content
{
width: 800px;
height: 1000px;
margin: 0 auto;
text-align: center;
background-color: #888;
}
<div id="loading-wrapper">
<div id="loading-text">LOADING</div>
<div id="loading-content"></div>
</div>