我正在尝试制作如下图所示的菜单:
我是这样做的:
如何将菜单中的项目与图片居中?这是我的作业,尽管我尽力了,但还是做不到。预先感谢您的帮助。
body {
font-family: Poppins;
background-color: #F5F6F6;
}
.container {
width: 70%;
margin: 0 auto;
}
.top-space {
height: 25px;
}
.navbar ul li {
display: inline;
}
.navbar ul li a {
text-decoration: none;
line-height: 50px;
}
.navbar ul li img {
height: 50px;
}
Document
如果您能告诉我您编写的代码的工作原理,我将不胜感激。
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
您必须添加
display:flex;,如下所示:.navbar ul{display:flex;}