我有一个标识,我想链接回我的主页。但是,当我超链接徽标时,我注意到链接横跨整个页面(即横跨徽标左侧和右侧的空白),而不是仅放在徽标图像上。我的超链接遍历整个页面而不仅仅是图片
我的HTML:
<a href="#" id="splash-logo">
<img src="images/splash-logo.png" width="259" height="51">
</a>
我的CSS:
#splash-logo {
clear: both;
width:100%;
display: inline-block;
text-align:center;
}
谢谢!
你的CSS显示元素的宽度为100%,所以它会占用整个页面的宽度。如果您希望将其设置为图像的大小,请将其设置为259px。 – John 2012-07-26 17:39:30