因为我的英语不好,请原谅我。
我在https://jsfiddle.net/3vmajng0/上有这个导航栏
<nav class="navbar navbar-expand-lg navbar-light bg-light sb-navbar">
<div class="container">
<a class="navbar-brand" data-toggle="collapse" data-target="#navbarSupportedContent"
aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="ml-1">Start Bootstrap</span>
</a>
<div class="avatar-image">
</div>
<div class="navbar-collapse collapse" id="navbarSupportedContent">
<ul class="navbar-nav mr-auto pt-3 pt-lg-0">
<li class="nav-item">
<a class="nav-link" routerLink="/">Home</a>
</li>
<li class="nav-item">
<a class="nav-link" routerLink="/item">Product</a>
</li>
<li class="nav-item">
<a class="nav-link" routerLink="/about">About Us</a>
</li>
</ul>
</div>
</div>
</nav>
当我单击“启动引导程序”文本时,将显示菜单,但头像也会向下推菜单。见下图
再次抱歉,因为我无法发布图片。它说:“您至少需要10个信誉才能发布图像”
有人对我有解决办法吗?
答案 0 :(得分:0)
如果没有,请应用css部分
.avatar-image {
background-image: url('https://avatars.servers.getgo.com/2205256774854474505_medium.jpg');
background-size: cover;
height: 40px;
width: 40px;
border-radius: 50%;
flex-shrink: 0;
object-fit: cover;
}
答案 1 :(得分:0)
在@variable
类中添加float: right
属性。
.avatar-image
.avatar-image {
float: right;
background-image: url('https://avatars.servers.getgo.com/2205256774854474505_medium.jpg');
background-size: cover;
height: 40px;
width: 40px;
border-radius: 50%;
flex-shrink: 0;
object-fit: cover;
}