html - 如何对齐 "Click here"旁边的图标?

标签 html css alignment

如何在“单击此处”旁边对齐图标?

我能够使用下面的 CSS 来完成它,但是在 PC 上使用 firefox、chrome 和 safari 时图标没有对齐。

<div class="link_container">
            <a href="#" class="click_action">Click here</a> 
            <a class="sprite_image action_image"></a>
            </div>


.link_container {
    margin-top: -10px;
    padding-bottom: 10px;
}
.click_action {
    color: #999;
    font-size: 12px;
    text-decoration:none;
}
.sprite_image {
    background: url('sprite.png');
}
.action_image {
    background-repeat: no-repeat;
    background-position: -116px -12px;
    width: 10px;
    height: 10px;
    position: absolute;
    margin-left: 3px;
    margin-top: 4px;
}

最佳答案

您可以将其添加到 .click_action 和 .sprite_image CSS:

float: left;

关于html - 如何对齐 "Click here"旁边的图标?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16735837/

相关文章:

css - Bootstrap 响应式列对齐,叠加图像居中

css - 将四个不同的 div 垂直居中

HTML 日期显示对齐

css - Bootstrap 4 中心元素仅在小视口(viewport)上,但在其他所有尺寸上都没有对齐?

css - 调整网页高度为手机屏幕高度

html - 选择有或没有容器的第一个 parent

html - CSS 网格 - 2x2 网格总是尽可能占据整个宽度

javascript - 使用 javascript 添加新的 div 元素

javascript - 如何在所有浏览器和设备上将网页上的某些元素居中?

javascript - HTML: 在字符串中嵌套 '