简体   繁体   English

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

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

I'm building a react portfolio.我正在建立一个反应组合。 I'm struggling to style my footer.我正在努力设计我的页脚。 I only want to include icons of Github and LinkedIn on it.我只想在上面包含 Github 和 LinkedIn 的图标。 I want to have them side-by-side, and at the bottom of the screen once you reach the end of the page.我想让它们并排放置,并且在您到达页面末尾时位于屏幕底部。 Currently, the two icons are stacked vertically at the bottom, in the middle of the page, with a lot of space between the two rows.目前,这两个图标垂直堆叠在底部,在页面中间,两行之间有很大的空间。 I have react-bootstrap implemented.我已经实施了反应引导程序。

Here's my footer component:这是我的页脚组件:

 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;

Here's my related css:这是我的相关 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;

} 

Here's my app.js (only the parts related to the footer):这是我的 app.js(只有与页脚相关的部分):

import Footer from './components/Footer';

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

    


export default App; 

I have tried many methods and nothing is working.我尝试了很多方法,但没有任何效果。 i have included the above code that is above.我已经包含了上面的代码。 Please help me, I really appreciate it请帮助我,我真的很感激

It seems that ul has class flex-row but does not have its display set as flex , therefore the flex behavior is not enabled.似乎ul有 class flex-row但没有将其display设置为flex ,因此未启用 flex 行为。

For a Bootstrap solution to fix this, perhaps try add d-flex , justify-content-center , align-items-center and (if the default list style also needed to be removed) list-unstyled to the className of ul .对于解决此问题的 Bootstrap 解决方案,也许可以尝试将d-flexjustify-content-centeralign-items-center和(如果还需要删除默认列表样式) list-unstyledclassNameul名。

Simplified demo on: stackblitz简化演示: 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并排居中? - How can I center two images side-by-side with Bootstrap 3? 如何并排获得这两个div? - How to get these two divs side-by-side? 如何并排获得两个表单域,每个图例位于该域上方? - How can I get two form fields side-by-side, with each legend above the field? 我的两列都堆积在Zurb中。 如何并排显示它们? - My 2 columns are stacking in Zurb. How can I display them side-by-side? 如何使徽标图标显示在页脚的右侧? - How do I make the logo icons to appear on the right side of my footer? 似乎无法让两个要素并存 - Can't seem to get two elements to be side-by-side 如何并排获得两个表单字段,每个字段的 label 在字段上方,在 CSS 中? - How can I get two form fields side-by-side, with each field’s label above the field, in 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> - 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? 为什么我不能得到两个 <p> 元素可以并排并按中心对齐? - Why can't I get two <p> elements to be side-by-side and aligned by center? 如何在页脚中并排放置两个图标(图像)? - How do you centre two icons (images) side by side in footer?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM