简体   繁体   English

将导航栏与徽标中心对齐(图片)

[英]Align Nav-Bar to center of logo (Image)

I created a little test website with UIKit. 我使用UIKit创建了一个小测试网站。 Now that I messed around with that I wanted to try and create the design without using a pre-made framework. 既然我已经弄乱了,我想尝试在不使用预制框架的情况下创建设计。 I am having issues with my navbar though. 我的导航栏有问题。

This is the Original navbar that was created on the UIKit, see how the text is aligned vertically with the middle of the logo. 这是在UIKit上创建的原始导航栏,请参见文本如何与徽标中间垂直对齐。 在UIKit上创建的原始导航栏

This is the second image, which is the Navbar i am trying to create, as you can see the text is on the same row as the image, but it is aligned with the top of the image (logo) 这是第二个图像,即我正在尝试创建的导航栏,因为您可以看到文本与图像位于同一行,但与图像顶部对齐(徽标) 我正在尝试创建的导航栏

I am Trying to make the second image like the first image, the text aligned with the centre of the logo. 我正在尝试使第二个图像像第一个图像一样,文字与徽标的中心对齐。 I have tried "vertical-align: middle;" 我已经尝试过“ vertical-align:middle;” in my css but it doesn't seem to work... Any ideas? 在我的CSS中,但似乎不起作用...有什么想法吗?

Here's my code: 这是我的代码:

 html { font-family: monospace; font-size: 12pt; } body { margin: 0; } header { background-color: honeydew; } nav .ul { list-style-type: none; display: table; margin: 0; padding: 0; overflow: hidden; float: left; vertical-align: middle; } li { display: table-cell; vertical-align: middle; } 
 <header> <div class="row"> <nav> <ul class="column small-hidden large-12"> <li class="column small-hidden large-3">&nbsp;</li> <li class="column small-hidden large-1">Yep</li> <li class="column small-hidden large-1">Yep</li> <li style="float: center;" class="column small-hidden large-1 logo"><img alt="Website Logo" src="img/image.png"></li> <li class="column small-hidden large-1">Yep</li> <li class="column small-hidden large-1">Yep</li> <li class="column small-hidden large-3">&nbsp;</li> </ul> </nav> </div> </header> 

Thanks in advance! 提前致谢!

您可以尝试以下方法:

nav li.img{ vertical-align: middle;}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM