简体   繁体   English

Joomla 4 与 Bootstrap 5 模板自定义 css 不工作

[英]Joomla 4 with Bootstrap 5 template custom css not working

I made a basic bootstrap 5 template for my Joomla 4 website and trying to customize navbar but css added to user.css some how not working.我为我的 Joomla 4 网站制作了一个基本的 bootstrap 5 模板,并尝试自定义导航栏,但 css 添加到 user.css 一些如何不起作用。

I see the user.css is loaded in the source code of the page and also see the code inside the user.css file on the web server.我看到 user.css 已加载到页面的源代码中,还看到了网络服务器上 user.css 文件中的代码。

Here is my navbar code and css:这是我的导航栏代码和 CSS:

user.css用户.css

nav .navbar-dark .nav-link {
  text-decoration: none !important;
}

Index.php索引.php

<nav class="navbar navbar-dark bg-dark navbar-expand-lg">
  <div class="container-fluid">
    <a href="" class="navbar-brand"><?php echo ($sitename); ?></a>
    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#mainmenu" aria-controls="mainmenu" aria-expanded="false" aria-label="Toggle navigation">
      <span class="navbar-toggler-icon"></span>
    </button>
    <!-- Put menu links in the navbar -->
    <?php if ($this->countModules('menu')): ?>
    <div class="collapse navbar-collapse" id="mainmenu">
      <jdoc:include type="modules" name="menu" style="none" />
    </div>
    <?php endif; ?>
  </div>
</nav>

https://jsfiddle.net/nLp4je5m/ https://jsfiddle.net/nLp4je5m/

text-decoration: underline is applied to the a tag. text-decoration: underline应用于a标签。 Therefore you need to因此你需要

  1. remove the space between nav.navbar-dark AND删除nav.navbar-dark和之间的空格
  2. add a添加a
nav.navbar-dark .nav-link a {
  text-decoration: none;
}

to remove the line.删除该行。 !important should only be needed if you have other CSS definitions modifying the text-decoration for a elements. !important仅在您有其他 CSS 定义修改元素a文本装饰时才需要。

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

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