2.在每个屏幕上图像的大小和位置看起来都不同

时间:2019-03-21 07:09:34

标签: css mobile css-position compatibility

我已经查看了该站点上以前回答的主题。我无法调整。虽然我已经在css文件中设置了大小和位置。大画面位于中间,因此适合屏幕。我给imaged1类在不同的地方和不同的大小提供了小的可视显示。这些代码可以提供帮助吗?enter image description here

.imaged1 {
    position: absolute;
    top: 80px;
    left: 240px;
    width: 65px;
    height: 65px;
    margin: 0 auto;
    -webkit-animation: spin 15s linear infinite;
    -moz-animation: spin 15s linear infinite;
    animation: spin 15s linear infinite;
    bottom: auto;
}
@-moz-keyframes spin { 100% { -moz-transform: rotate(360deg); } }
@-webkit-keyframes spin { 100% { -webkit-transform: rotate(360deg); } }
@keyframes spin { 100% { -webkit-transform: rotate(360deg); transform:rotate(360deg); } }
.center {
  display: block;
  margin-left: auto;
  margin-right: auto;
  width: 50%;
}
	<img class="center" img src="https://i.ibb.co/BsDB7nW/1.png">
	<img class="imaged1" src="https://i.ibb.co/7p3bYLN/d1.png">

enter image description here

enter image description here

1 个答案:

答案 0 :(得分:-1)

以下代码可能会帮助您:

    <div style="text-align: center;position: relative;width:50%;">
       <img class="center" img src="https://i.ibb.co/BsDB7nW/1.png">
         <img class="imaged1" src="https://i.ibb.co/7p3bYLN/d1.png">
    </div>

    .imaged1 {
    position: absolute;
    top: 36%;
    left: 40%;
    width: 19%;
    margin: 0 auto;
    -webkit-animation: spin 15s linear infinite;
    -moz-animation: spin 15s linear infinite;
    animation: spin 15s linear infinite;
    bottom: auto;
   }
   @-moz-keyframes spin { 100% { -moz-transform: rotate(360deg); } }
   @-webkit-keyframes spin { 100% { -webkit-transform: rotate(360deg); } }
   @keyframes spin { 100% { -webkit-transform: rotate(360deg); transform:rotate(360deg); } }
  .center {
   display: block;
   width: 100%;
   }

Please check this fiddle for my best guess what you require

And here is the previously asked question