【问题标题】:Display:flex not working when added into my css no matter what I try无论我尝试什么,当添加到我的 CSS 中时,显示:flex 都不起作用
【发布时间】:2021-05-09 09:50:07
【问题描述】:

我的 css 和 html 如下所示:

#TopBar{
    

display: flex;
justify-content: space-between;
z-index: 1;
position: fixed;
top: 0px;
left: 0px;
background-color: rgb(25,25,25);
height:115px;
width: 2000px; 
}
#Logo{

    
top: 0px;

height: 110px; width: 110px;
display: inline-block;

z-index: 2;
background-size: contain;
}
.NavList{

color: grey;
text-decoration: none;
font-family: Arial;
font-size: 30px;
margin-top: 1.3%;
z-index: 3;
}
    

<div id = TopBar>
<ul style = "list-style-type:none;">
<a class = NavList id = NavHome href = "../index.html">HOME</a>
<a class = NavList id = NavLogin href = "AccountPage.html" onclick = 
"account()">ACCOUNT</a>
<a class = NavList id = NavAccount href = "../Rules 
Page/Rules.html">RULES</a>
<a class = NavList id = NavDark href = "FillerPage.html">LIGHT</a> 
</ul>
</div>
<a href="https://google.com"><img src="../Images/VenomLogo5.png" id = "Logo"> 
</img></a>
</div>
</head>

每当我添加 flex 或任何其他东西(例如证明内容)时,它都不会做任何事情,而且我不知道我做错了什么。我觉得这很简单,但我无法弄清楚。提前致谢!

【问题讨论】:

    标签: javascript html css web flexbox


    【解决方案1】:

    看看this是不是你想要的。您需要在ul 中设置width 并将其设置为弹性容器。然后你就可以添加space-between

    对于 css 部分,我使用 SCSS,以便您可以编写嵌套 css。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-08-11
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2019-06-20
      • 1970-01-01
      • 2017-10-27
      相关资源
      最近更新 更多