简体   繁体   English

如何使2个图标一左一右对齐?

[英]How to make 2 icons to be aligned one to the left and one to the right?

I tried to search the internet, but I saw nothing.我试图在互联网上搜索,但我什么也没看到。 My problem is very easy, I have 2 icons and want one of them to be aligned to the left and the other on to the right.我的问题很简单,我有 2 个图标,并希望其中一个与左侧对齐,另一个在右侧对齐。 The code follows:代码如下:

<div class="container">
    <div class="row">
        <div style="cursor: pointer" onclick="window.history.back()">
            <div class="back-button" data-wow-delay="0.2s" style="padding: 0 0 0 25px">
                <div class="icon color-1" style="margin-bottom: 0">
                    <i class="lni-pointer-left"></i>
                </div>
            </div>
        </div>
        <div style="cursor: pointer" onclick="window.history.back()">
            <div class="back-button" data-wow-delay="0.2s" style="padding: 0 0 0 25px">
                <div class="icon color-1" style="margin-bottom: 0">
                    <i class="lni-pointer-left"></i>
                </div>
            </div>
        </div>
    </div>
</div>

PS: Float: right didn't help... PS:浮动:对没有帮助......

Add This Class d-flex justify-content-between添加此类d-flex justify-content-between

<div class="container">
        <div class="d-flex justify-content-between">
            <div style="cursor: pointer" onclick="window.history.back()">
                <div class="back-button" data-wow-delay="0.2s" style="padding: 0 0 0 25px">
                    <div class="icon color-1" style="margin-bottom: 0">
                        <i class="lni-pointer-left">Icon 1</i>
                    </div>
                </div>
            </div>
            <div style="cursor: pointer" onclick="window.history.back()">
                <div class="back-button" data-wow-delay="0.2s" style="padding: 0 0 0 25px">
                    <div class="icon color-1" style="margin-bottom: 0">
                        <i class="lni-pointer-left">Icon 2</i>
                    </div>
                </div>
            </div>
        </div>
    </div>

https://jsfiddle.net/lalji1051/th05ad8c/1/ https://jsfiddle.net/lalji1051/th05ad8c/1/

flexbox works best as it offers minimal code. flexbox效果最好,因为它提供了最少的代码。 follow the example below:请按照以下示例操作:

 #icon-row { display: flex; justify-content: space-between; padding: 20px; border: 1px solid lightgrey; } a { cursor: pointer; background-color: lightgrey; padding: 5px; }
 <div id="icon-row"> <a>icon</a> <a>icon</a> </div>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何在表格单元格(td)中定位元素,使得一个元素左对齐而另一个元素对齐? - How can I position elements within a table cell (td) such that one element is left aligned and the other right aligned? 如何使图像左对齐和内容右对齐? - How to make image aligned left and content right? 两个跨度,一个左对齐,一个右对齐,两个都底部对齐 - two spans, one left aligned, one right aligned, both bottom aligned 如何使两个对象水平对齐(一个在另一个的右侧)并居中放置一个? - How can I have two objects aligned horizontally (one to the right of the other) and center the left one? 如何在同一行上有两个DIV,一个不带HTML表格,一个左对齐,一个右对齐? - How can I have two DIV s on the same line , one aligned to the left and one aligned to the right without an HTML table? 两个导航栏,上一个右对齐,下一个左对齐 - Two Navigation Bars, top one aligned right, bottom one aligned left 材质用户界面。 网格内的 2 个项目; 一个左对齐,一个右对齐。 在同一行 - Material UI. 2 items inside a grid; one left-aligned, one right-aligned. In the same line 如何让左右对齐的按钮响应(一个接一个显示) - How to get left and right aligned buttons to be responsive (displayed one after other) 使标题与图标对齐在正确的HTML / CSS上 - Make header with icons aligned on the right HTML/CSS 如何使第一个元素与右侧对齐,其他元素在左侧对齐? - How to make the first element aligned to the right and the other elements in the left of that first?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM