这是我的 HTML: <div id="user-avatar"><img src="/imgs/frame.png" alt=""/></div> 用户头像类如下: #user-
... . . 这是我的 HTML:
<div id="user-avatar"><img src="/imgs/frame.png" alt=""/></div>
用户头像类如下:
#user-avatar { width: 100px; height: 100px; margin: auto; position: relative; background: url(images/avatars/128.jpg) 50% 50% no-repeat;}
帧:
#user-avatar img { position: absolute; top: 50%; left: 50%; width: 122px; height: 127px; margin-top: -62px; margin-left: -63px; }
原始用户头像背景图像尺寸是23×25,但我希望它被调整为100x100px,问题是,无论我在宽度:xxx属性中设置它都不起作用.框架后面的头像每次都有原始尺寸.
.解决方法
. 您无法将图像集调整为容器的背景.调整图像大小的唯一方法是使用img标记并使用width和height css属性调整其大小.
看看here可能会有所帮助.
. . .. ...