html - 我的超链接遍及整个页面,而不仅仅是图像

标签 html css

我有一个 Logo ,我想链接回我的主页。但是,当我对 Logo 进行超链接时,我注意到链接跨越了整个页面(即跨越了 Logo 左侧和右侧的空白区域),而不仅仅是在 Logo 图像上。

我的 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;
}

谢谢!

最佳答案

去掉width:100%,既然是100%宽度,当然会跨越(水平)整个页面

关于html - 我的超链接遍及整个页面,而不仅仅是图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11674875/

相关文章:

jQuery 我如何解决 Jquery 冲突

html - 将滚动条放置在元素内

html - position:fixed 导致 margin-top 消失?

css - 图像大小调整如何与 css 一起使用?

javascript - 如何将多个css文件添加到CKEditor编辑区

css - 我们是否应该始终为要使用内容 <p> 的 body {font-size :. ..} 保留相同的值?

javascript - 单击菜单内的链接后如何将汉堡包菜单图标重置为未打开状态?

html - 样式化 HTML5 数据列表

css - 重新创建模态外观

html - 通过 html 按钮(onclick)执行 shell 命令