html - Materialise 导航内容不会居中 ul 元素

标签 html css bootstrap-4 materialize nav

我正在尝试使用中心选项将导航内容居中

So it will look like this.

但是它不适用于 ul 属性。

Ends up looking like this instead.

我的代码:

...
        <div class="nav-content center" style="background-color: black">
            <ul class="tabs tabs-transparent">
                <li class="tab"><a href="">Test 1</a></li>
                <li class="tab"><a href="">Test 2</a></li>
            </ul>
        </div>
    </nav>

解决方案:

mdubus 的答案是正确的,但它需要位于 ul 元素而不是 div 中才能使用 Materialize 工作。

最佳答案

在您的 div nav-content center 上,只需添加 display:flex; justify-content:中心;。这应该可以解决问题;)

关于html - Materialise 导航内容不会居中 ul 元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54278682/

相关文章:

html - 位置 div 移动到 CSS Grid 中指定的不同位置

html - 如何在 div 元素内将图像居中 (HTML)

css - Three.js 旋转相机到特定位置

node.js - 错误: Cannot find module 'gulp-serve'

bootstrap-4 - 如何制作模态全屏?

javascript - 从文件夹加载 javascript 文件

c# - 无法将 CSS 应用于 html 字符串

html - 最大高度和最大宽度

使用 "+"激活的 CSS 定位不起作用

python - 使用 Dash 将工具提示添加到 Bootstrap Table 中的单元格