gpt4 book ai didi

html - bootstrap 颜色是如何工作的?

转载 作者:行者123 更新时间:2023-11-28 16:03:15 24 4
gpt4 key购买 nike

这些天我正在尝试练习使用 bootstrap,我想理解代码中的所有内容,但有一些我不明白的东西是 navbar colors,正如你在下面看到的,当我把 < strong>navbar-dark 类,导航栏不显示为深色,而是显示为白色,当我放置 "navbar-light"类 时,它将被显示灰色我正在努力解决这个问题,如果有人能帮助我,我将非常感激

<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8">
<title>TinDog</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<link rel="stylesheet" href="css/styles.css">

<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
</head>

<body>

<section id="title">

<!-- Nav Bar --> <!---->
<nav class="navbar navbar-expand-lg navbar-dark">
<!--why when i put the navbar-dark class the navbar doesn't display with a dark color but it's displayed whith a white color and when i put the "navbar-light" class it will be diplayed with a grey color i'm struggling with this problem please if anybody can help me i will be so thankful-->
<a class="navbar-brand" href="">tindog</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a href="#" class="nav-link">contact us</a>
</li>
<li>
<a href="#" class="nav-link">pricing</a>
</li>
<li>
<a href="#" class="nav-link">download</a>
</li>
</ul>
</div>
</nav>

最佳答案

.navbar-dark 更改导航栏内 anchor 元素的文本颜色。

您需要应用 bg-dark 来覆盖导航栏的默认颜色。

Navbar link

<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8">
<title>TinDog</title>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
<link rel="stylesheet" href="css/styles.css">

<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>
</head>

<body>

<section id="title">

<!-- Nav Bar --> <!---->
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
<!--why when i put the navbar-dark class the navbar doesn't display with a dark color but it's displayed whith a white color and when i put the "navbar-light" class it will be diplayed with a grey color i'm struggling with this problem please if anybody can help me i will be so thankful-->
<a class="navbar-brand" href="">tindog</a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a href="#" class="nav-link">contact us</a>
</li>
<li>
<a href="#" class="nav-link">pricing</a>
</li>
<li>
<a href="#" class="nav-link">download</a>
</li>
</ul>
</div>
</nav>

关于html - bootstrap 颜色是如何工作的?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53848213/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com