我试图使用top,left和right在我的网页中定位某些图像。当我的代码是
时,定位工作正常
IMenuModel

#something{
position:absolute;
top:45%;
left:25%;
}

但是当我在所述元素上实现一个类时,即
<div id="something"><img src="#"/></div>
&#13;
.class123{
height:70px;
width:70px;
}
#something{
position:absolute;
top:45%;
left:25%;
}
&#13;
根据我指定的左上角值,而不是我的身高和宽度,我的图像大小突然改变了。这是实际的代码
<div id="something" class="class123"><img src="#"/></div>
&#13;
html {
background: url(background.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}
@font-face{
font-family:myFirstFont;
src: url(FORCED_SQUARE.ttf);
}
/* logo section */
#logo{
display: block;
width: 13%;
margin: 50px auto 0 auto;
}
/* Icon section */
.icons{
-webkit-transition: all 1s ease;
-webkit-backface-visibility: hidden;
transition: all 1 ease;
height: 70px;
width: 70px;
}
#fbicon{
position: absolute;
margin-top: -73.75px;
left: 25%;
}
#liin{
position: absolute;
margin-top: -73.75px;
right: 25%;
}
.icons:hover{
transform: scale(1.5);
}
&#13;
感谢您的帮助!