CSS:清除锚标记的所有格式
我有一个网站,页面格式为 800 像素宽,图像占据顶部 40 像素。我用锚标记包裹图像,以便单击图像将用户带到主页。当我用锚标签包裹图像时,图像似乎向右移动了一点,这导致了对齐!
有没有办法可以完全清除锚标记的所有格式?
I have a site where the page is formatted to be 800px wide with an image taking up the top 40 pixels. I wrapped the image with an anchor tag so that clicking on the image takes user to home page. When I wrap the image with an anchor tag, the image seems to shift to the right a little bit which throws of the alignment!
Is there a way I can clear absolutely all formatting from an anchor tag?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果是超链接,则一定是经典的图像边框问题,它会向图像添加可见边框。试试这个(如果您愿意,请编辑
a img
部分以仅定位您的标头或图像 ID 或其他内容):Must be the classic image border issue that adds a visible border to your image if it's a hyperlink. Try this (if you wish, edit the
a img
part to only target your header or the image ID or something):大卫的评论是正确的;锚标记的每种样式(边框、边距、颜色、:visited 等)都必须单独撤消。 BoltClock 的建议对我来说已经足够了,但对于真正想要重置任何标签的其他人,请尝试查看 Yahoo 的重置 CSS (http://developer.yahoo.com/yui/3/cssreset/)。
David is right in his comment; Every style for the anchor tag (border, margin, color, :visited, etc) has to be individually undone. BoltClock's suggestion is sufficient for me, but for anyone else who truly does want to reset any tag, try looking at Yahoo's reset CSS (http://developer.yahoo.com/yui/3/cssreset/).