繁体   English   中英

我怎样才能在 React 应用程序的页脚中并排显示我的两个图标?

[英]How can i get my two icons side-by-side in my footer in React app?

我正在建立一个反应组合。 我正在努力设计我的页脚。 我只想在上面包含 Github 和 LinkedIn 的图标。 我想让它们并排放置,并且在您到达页面末尾时位于屏幕底部。 目前,这两个图标垂直堆叠在底部,在页面中间,两行之间有很大的空间。 我已经实施了反应引导程序。

这是我的页脚组件:

 import {AiFillGithub} from "react-icons/ai";
 import {AiFillLinkedin} from "react-icons/ai";

function Footer() {
    return (
        <footer className="justify-content-center font-link">
            <div className="primary flex-row center">
                <ul className="flex-row">
                    <li className="links">
            <a href="https://github.com/PhuongHoang68"
            target="_blank"
            rel="noreferrer"
            >
                <h3 className="icon"><AiFillGithub size="3rem"/></h3>
            </a>
            </li>
            <li className="links">
            <a href="https://www.linkedin.com/in/phuong-hoang-a0b4901a5/"
            target="_blank"
            rel="noreferrer"
            >
                <h3 className="icon"><AiFillLinkedin size="3rem"/></h3>
            </a>
            </li>
            </ul>
            </div>
        </footer>
    )
}

export default Footer;

这是我的相关 css:

.App {
  font-family: sans-serif;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

footer {
  background-color: gray;
  text-align: center;
  margin-top: auto;
  padding: 8px;
}
html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  padding: 0;
  font-weight: 600;
  line-height: 1.5;
  font-size: 18px;
  background: var(--dark);
  color: var(--light);
  font-family: 'Poiret One', cursive;

} 

这是我的 app.js(只有与页脚相关的部分):

import Footer from './components/Footer';

        <div className="app">
            <Footer />
        </div>

    


export default App; 

我尝试了很多方法,但没有任何效果。 我已经包含了上面的代码。 请帮助我,我真的很感激

似乎ul有 class flex-row但没有将其display设置为flex ,因此未启用 flex 行为。

对于解决此问题的 Bootstrap 解决方案,也许可以尝试将d-flexjustify-content-centeralign-items-center和(如果还需要删除默认列表样式) list-unstyledclassNameul名。

简化演示: stackblitz

<ul className="d-flex flex-row justify-content-center align-items-center list-unstyled">
...
</ul>

我怎样才能得到一个<div>漂浮在另外两个之上<div> s 如果空间太窄,三个人都不能并排?</div><div id="text_translate"><p> 我有一个由两个&lt;div&gt;并排组成的进度条,在&lt;dd&gt;内浮动到右侧。 在进度条的左侧,我在另一个&lt;div&gt;中有一些文本。 如果&lt;dd&gt;太窄,我希望&lt;div&gt;包含文本到进度条顶部的 go,而不是分成两行。</p><p> 我正在使用 bootstrap.css 没有修改: </p><p></p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"><div class="snippet-code"><pre class="snippet-code-css lang-css prettyprint-override"> .col-6 { -ms-flex: 0 0 50%; flex: 0 0 50%; max-width: 50%; position: relative; width: 100%; padding-right: 15px; padding-left: 15px; }.my-0 { margin-top: 0;important. }:py-2 { padding-top. 0;5rem.important: };float-left { float. left:important; }.float-right { float: right;important. }:bg-success { background-color; #28a745 !important; } .bg-danger { background-color: #dc3545 !important; }</pre><pre class="snippet-code-html lang-html prettyprint-override"> &lt;dd class="col-6 my-0"&gt; &lt;div class="float-left"&gt;Some text&lt;/div&gt; &lt;div class="py-2 float-right bg-success" style="width:10px;"&gt;&lt;/div&gt; &lt;div class="py-2 float-right bg-danger" style="width:90px;"&gt;&lt;/div&gt; &lt;/dd&gt;</pre></div></div><p></p><p> 我尝试将z-index添加到&lt;div&gt; ,但无法达到我想要的效果。</p><p> 怎么做?</p></div></div>

[英]How can I get a <div> to float on top of two other <div>s if the space is too narrow for all three to stay side-by-side?

暂无
暂无

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

相关问题 如何将两个图像与Bootstrap 3并排居中? 如何并排获得这两个div? 如何并排获得两个表单域,每个图例位于该域上方? 我的两列都堆积在Zurb中。 如何并排显示它们? 如何使徽标图标显示在页脚的右侧? 似乎无法让两个要素并存 如何并排获得两个表单字段,每个字段的 label 在字段上方,在 CSS 中? 我怎样才能得到一个<div>漂浮在另外两个之上<div> s 如果空间太窄,三个人都不能并排?</div><div id="text_translate"><p> 我有一个由两个&lt;div&gt;并排组成的进度条,在&lt;dd&gt;内浮动到右侧。 在进度条的左侧,我在另一个&lt;div&gt;中有一些文本。 如果&lt;dd&gt;太窄,我希望&lt;div&gt;包含文本到进度条顶部的 go,而不是分成两行。</p><p> 我正在使用 bootstrap.css 没有修改: </p><p></p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"><div class="snippet-code"><pre class="snippet-code-css lang-css prettyprint-override"> .col-6 { -ms-flex: 0 0 50%; flex: 0 0 50%; max-width: 50%; position: relative; width: 100%; padding-right: 15px; padding-left: 15px; }.my-0 { margin-top: 0;important. }:py-2 { padding-top. 0;5rem.important: };float-left { float. left:important; }.float-right { float: right;important. }:bg-success { background-color; #28a745 !important; } .bg-danger { background-color: #dc3545 !important; }</pre><pre class="snippet-code-html lang-html prettyprint-override"> &lt;dd class="col-6 my-0"&gt; &lt;div class="float-left"&gt;Some text&lt;/div&gt; &lt;div class="py-2 float-right bg-success" style="width:10px;"&gt;&lt;/div&gt; &lt;div class="py-2 float-right bg-danger" style="width:90px;"&gt;&lt;/div&gt; &lt;/dd&gt;</pre></div></div><p></p><p> 我尝试将z-index添加到&lt;div&gt; ,但无法达到我想要的效果。</p><p> 怎么做?</p></div></div> 为什么我不能得到两个 <p> 元素可以并排并按中心对齐? 如何在页脚中并排放置两个图标(图像)?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM