My previous (similar) question has been closed as a duplicate with the following notice:
This question already has answers here: Customizing Bootstrap CSS template (9 answers) Your post has been associated with a similar question. If this question doesn’t resolve your question, ask a new one.
And since no, this question doesn't resolve my question, here I am asking a new one. Specifically, unanswered issues are:
- Most answers in the linked question are about earlier versions of Bootstrap. My question is about Bootstrap 5, as mentioned in the title.
- The answer in the linked question that is referring version 5 is only explaining SASS, but I'm looking for a solution with CSS, as mentioned in the title.
- I posted a minimal example but there is no minimal example solution in the linked question.
I have this minimal example of a Bootstrap 5 page below. As you can see, by default it uses black text color, white background color, and kinda blue to highlight certain items. How can I change this default color scheme with CSS? I assume I can just insert a custom <style>
tag? Or maybe just include another CSS via <link>
from somewhere?
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-F3w7mX95PdgyTmZZMECAngseQB83DfGTowi0iMjiWaeVhAn4FJkqJByhZMI3AhiU" crossorigin="anonymous">
<title>Hello, world!</title>
</head>
<body>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="flexCheckDefault">
<label class="form-check-label" for="flexCheckDefault">
Default checkbox
</label>
</div>
<div class="form-check">
<input class="form-check-input" type="checkbox" value="" id="flexCheckChecked" checked>
<label class="form-check-label" for="flexCheckChecked">
Checked checkbox
</label>
</div>
<div class="accordion" id="accordionPanelsStayOpenExample">
<div class="accordion-item">
<h2 class="accordion-header" id="panelsStayOpen-headingOne">
<button class="accordion-button" type="button" data-bs-toggle="collapse" data-bs-target="#panelsStayOpen-collapseOne" aria-expanded="true" aria-controls="panelsStayOpen-collapseOne">
Accordion Item #1
</button>
</h2>
<div id="panelsStayOpen-collapseOne" class="accordion-collapse collapse show" aria-labelledby="panelsStayOpen-headingOne">
<div class="accordion-body">
<strong>This is the first item's accordion body.</strong> It is shown by default, until the collapse plugin adds the appropriate classes that we use to style each element. These classes control the overall appearance, as well as the showing and hiding via CSS transitions. You can modify any of this with custom CSS or overriding our default variables. It's also worth noting that just about any HTML can go within the <code>.accordion-body</code>, though the transition does limit overflow.
</div>
</div>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.1/dist/js/bootstrap.bundle.min.js" integrity="sha384-/bQdsTh/da6pkI1MST/rWKFNjaCP5gBSY4sEBT38Q/9RBh9AH40zEOg7Hlq2THRZ" crossorigin="anonymous"></script>
</body>
</html>
Snippet put together from the examples at https://getbootstrap.com/docs/5.1/getting-started/introduction/, https://getbootstrap.com/docs/5.1/forms/checks-radios/ and https://getbootstrap.com/docs/5.1/components/accordion/.