简体   繁体   English

UIkit uk-navbar-center不居中

[英]UIkit uk-navbar-center not centering

I am using a very simple UIKIT navbar layout. 我使用的是非常简单的UIKIT导航栏布局。

The default is for the navigation items to be left align. 默认情况下,导航项保持左对齐。

在此处输入图片说明

I am trying to center the navbar items by using uk-navbar-center whic yields this result 我正在尝试使用uk-navbar-center whic将导航栏项居中,从而产生此结果

在此处输入图片说明

As you can see the items are not totaly centered. 如您所见,这些项目并未完全居中。

Here is my code: 这是我的代码:

<nav class="uk-navbar">
  <ul class="uk-navbar-nav uk-navbar-center uk-hidden-small">
    <li><a href="">Option 1</a></li>
    <li><a href="">Option 11</a></li>
    <li><a href="">Option 2</a></li>
    <li><a href="">Option 3</a></li>
  </ul>
</nav>

<hr class="uk-grid-divider">
<div class="uk-container uk-container-center uk-text-center">
  <a class="uk-button" href="">Link</a>
  <button class="uk-button uk-button-primary uk-button-mini" type="button">Button</button>
  <button class="uk-button" type="button" disabled>Button</button>
</div>

Any ideas why this is not centered? 有什么想法为什么不居中吗?

Many thanks! 非常感谢!

I found the solution. 我找到了解决方案。 You need to use the flex component. 您需要使用flex组件。 If you add the following two classes uk-flex & uk-flex-center this will center the menu items. 如果添加以下两个类uk-flex和uk-flex-center,则这将使菜单项居中。

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

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