【发布时间】:2020-05-11 21:03:09
【问题描述】:
所以我尝试查找其他人在使用 flex-end 和 justify-content 时遇到的类似问题,但似乎没有一个解决方案适合我。我对开发网站有点陌生,我猜我还在学习基础知识。
我想避免只添加 margin-left 和添加一堆媒体查询,因为我猜它感觉不对?
编辑:对不起,我应该更具体地说明我想要的。我基本上想要 MC# 和标题末尾的“与我们交谈”。这就是它目前的样子website
块引用
JSX
<header className={headerStyles.header}>
<nav>
<ul className={headerStyles.navList}>
<li>
<Link className={headerStyles.title} to="/">
{data.site.siteMetadata.title}
</Link>
</li>
<li>
<Link className={headerStyles.navItem} activeClassName={headerStyles.activeNavItem} to="/">Home</Link>
</li><br />
<li>
<Link className={headerStyles.navItem} activeClassName={headerStyles.activeNavItem} to="/blog">Blog</Link>
</li><br />
<li>
<Link className={headerStyles.navItem} activeClassName={headerStyles.activeNavItem} to="/about">About</Link>
</li><br />
<li>
<Link className={headerStyles.navItem} activeClassName={headerStyles.activeNavItem} to="/contact">Contact</Link>
</li>
<li className={headerStyles.mcNum}>
<p>MC# 1322334</p>
<p className={headerStyles.vline}>Talk To Us!<br /> <a href="tel:800-888-8888">800-888-8888</a></p>
</li>
</ul>
</nav>
CSS
.header {
position: fixed;
padding: .5rem 5rem 0rem;
background: white;
box-shadow: 0px 4px 8px -4px rgba(0,0,0,0.3);
z-index: 500;
width: 100%;
display: flex;
align-items: stretch;
height: auto;
}
.title {
color: black;
font-size: 1.5rem;
text-decoration: none;
margin-right: 5rem;
float: left;
display: table-cell;
vertical-align: middle;
white-space: nowrap;
font-family: 'Lato', sans-serif;
}
.nav-list {
display: flex;
align-items: center;
list-style-type: none;
margin: 0;
font-weight: 700;
font-family: 'Lato', sans-serif;
}
.nav-item{
color: black;
font-size: 1.1rem;
font-weight: 400;
font-family: 'Lato', sans-serif;
margin-right: 2.2rem;
text-decoration: none;
}
.mcNum {
display: flex;
align-items: center;
justify-items: flex-end;
white-space: nowrap;
}
【问题讨论】: