Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Bootstrap problems with navbar

Contributor ,
Jun 10, 2022 Jun 10, 2022

I used bootstrap to create a navbar. It works well enough, but the dropdown link is lightned to the point where it is hard to read. The other links are solid white, but the dropdown link is about 50% transparent. I tried using the .show class to change it to solid white, but I was unsucessful. Please advise on how to update the code. Thanks.

1.7K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

LEGEND , Jun 10, 2022 Jun 10, 2022

Create a new css stylesheet and link it to your page AFTER the link to the default Bootstrap css file. You never want to alter the default Bootstrap css file. Then add the below css to the newly created css style sheet:

 

.nav-link.dropdown-toggle {
color: #fff!important;
}
.nav-link.dropdown-toggle:hover {
color: #ccc!important;
}

 

OR add a <style> </style> block AFTER the link to the default Bootstrap css file and add your updated css style there:

 

<style>

.nav-link.dropdown-toggle {
color: #fff!importan

...
Translate
LEGEND ,
Jun 10, 2022 Jun 10, 2022

Can you post the navbar code in the forum so we can see what navbar structure and Bootstrap classes you are using?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jun 10, 2022 Jun 10, 2022
Thanks. here it is:
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="../css/bootstrap-4.4.1.css" rel="stylesheet" type="text/css">
<title>untitlted</title>
</head>
<body style="padding-top: 70px">
<nav class="navbar fixed-top navbar-expand-lg navbar-dark bg-primary"> <a class="navbar-brand" href="#">Direct Scientific</a>
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent1" aria-controls="navbarSupportedContent1" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button>
 <div class="collapse navbar-collapse" id="navbarSupportedContent1">
   <ul class="navbar-nav mr-auto">
     <li class="nav-item active"> <a class="nav-link" href="#">Home <span class="sr-only">(current)</span></a> </li>
<li class="nav-item active"> <a class="nav-link" href="#">Nuclear Instrumentation <span class="sr-only">(current)</span></a> </li>
     <li class="nav-item active"> <a class="nav-link" href="#">Shielding<span class="sr-only">(current)</span></a> </li>
<li class="nav-item active"> <a class="nav-link" href="#">Sources<span class="sr-only">(current)</span></a> </li>
 
     <li class="nav-item dropdown"> <a class="nav-link dropdown-toggle" href="#" id="navbarDropdown1" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Accessories</a>
       <div class="dropdown-menu" aria-labelledby="navbarDropdown1"> <a class="dropdown-item" href="#">Fume Hoods</a> <a class="dropdown-item" href="#">Marinelli Beakers</a>
<a class="dropdown-item" href="#">Hazard Signage</a>
<a class="dropdown-item" href="#">Herculite</a>
         <div class="dropdown-divider"></div>
         <a class="dropdown-item" href="#">HEPA Vacs</a> </div>
 
          <li class="nav-item active"> <a class="nav-link" href="#">Search<span class="sr-only">(current)</span></a> </li>
<li class="nav-item active"> <a class="nav-link" href="#">Contact<span class="sr-only">(current)</span></a> </li>
 
 </ul></div>
</nav>
<script src="../js/jquery-3.4.1.min.js"></script>
<script src="../js/popper.min.js"></script>
<script src="../js/bootstrap-4.4.1.js"></script>
</body>
</html>
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 10, 2022 Jun 10, 2022

Create a new css stylesheet and link it to your page AFTER the link to the default Bootstrap css file. You never want to alter the default Bootstrap css file. Then add the below css to the newly created css style sheet:

 

.nav-link.dropdown-toggle {
color: #fff!important;
}
.nav-link.dropdown-toggle:hover {
color: #ccc!important;
}

 

OR add a <style> </style> block AFTER the link to the default Bootstrap css file and add your updated css style there:

 

<style>

.nav-link.dropdown-toggle {
color: #fff!important;
}
.nav-link.dropdown-toggle:hover {
color: #ccc!important;
}

</style>
}

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jun 10, 2022 Jun 10, 2022

My God, how did you do that? Great answer and it works. thanks. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 10, 2022 Jun 10, 2022
quote

My God, how did you do that?

 

By @default0vaokg78cv42


Bootstrap is so bloated and obtuse its almost impossible for anyone new to Bootstrap to figure out what combination of selectors you need to use to change the css. You might get lucky by using the browser dev tool to inspect the css but its totally hit and miss. With experience you build up some vague knowledge of the selectors, which makes it slightly easier.

Personally I would NOT advice anyone to use Bootstrap, its a horrible bloated jumbled up piece of junk, in my opinion.

Css is not that difficult to learn and now we have flex and grid there is no need for anyone with any credibility to be using responsive frameworks, not ones which bloat the html and css output anyway.

But good luck in your journey.





 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jun 10, 2022 Jun 10, 2022

Makes sense. I am a beginner. I tried coding a navbar but could not get it to work on mobile view. I needed a quick fix. I am coding everything else myself, because I like CSS. Bootstrap is too limited/static. And thanks again. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 10, 2022 Jun 10, 2022
quote

Bootstrap is too limited/static.

============

Actally Bootstrap is highly flexible & customizable if you know how to use it.  I don't think you've given yourself enough discovery time using Bootstrap.

 

Power users leverage Bootstrap's built-in classes, mixins & variables with SASS.  Beginners use  Bootstswatch Themes (26 options).   Once you know how to use Bootstrap, the sky's the limit with what you can do. 

 

Nancy O'Shea— Product User, Community Expert & Moderator
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jun 10, 2022 Jun 10, 2022

I am reading a book about it now. It is interesting and the navbar looks nice. 

I am also learning CSS. When I correct bugs, I simply correct the errant code by emulating the code that functions properly. Not too scientific, but it works for now. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 10, 2022 Jun 10, 2022
quote
quote

Bootstrap is too limited/static.

============

Actally Bootstrap is highly flexible & customizable if you know how to use it.  I don't think you've given yourself enough discovery time using Bootstrap.


By @Nancy OShea

 

 

 Its not really highly flexible. Developers who use Bootstrap tend to use only the limited components that are available, rather than look for different alternatives. Its fairly shallow in what it offers and depending on how much you're going to customize it you may as well write your own styling.

 

Bootstrap was specifically written for back-end developement and that is where it really belongs.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 10, 2022 Jun 10, 2022
quote

Makes sense. I am a beginner. I tried coding a navbar but could not get it to work on mobile view. I needed a quick fix. I am coding everything else myself, because I like CSS. Bootstrap is too limited/static. And thanks again. 


By @default0vaokg78cv42

 

 

 

I dont know how efficient you are with code. You might want to search codepen for a responsive navigation menu without Bootstrap.

 

Below is something similar to what you require, its got the nice animated hamburger.

 

https://codepen.io/taniarascia/pen/dYvvYv/

 

The only down side to this example is it uses jQuery rather than vanilla javascript but you can see it uses far less html mark-up than Bootstrap and dont be fooled by the css, although it looks a lot, Bootstrap in the background is using just as much, if not more.

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 10, 2022 Jun 10, 2022

HTML:

<nav class="navbar navbar-expand-lg navbar-fixed-top navbar-light bg-primary">

 

image.png

CSS ~ change opacity from .5 to 1

====================

.navbar-light .navbar-nav .nav-link {
color: rgb(0, 0, 0, 1);
}

 

Result:

image.png

 

Nancy O'Shea— Product User, Community Expert & Moderator
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jun 10, 2022 Jun 10, 2022

Thanks very much, looks great. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 10, 2022 Jun 10, 2022

So that you do not get confussed, Bootstrap is all that I need to start a new project. It is a complete library that is very very flexible to use. The best part is that it is uniform, meaning that anyone with Bootstrap experience can help you immediately rather than having to wade through a CSS and JavaScript mess created by some code junkie.

 

In other words, listen to @Nancy OShea 👍

Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 11, 2022 Jun 11, 2022
quote

So that you do not get confussed, Bootstrap is all that I need to start a new project. It is a complete library that is very very flexible to use. The best part is that it is uniform, meaning that anyone with Bootstrap experience can help you immediately rather than having to wade through a CSS and JavaScript mess created by some code junkie.

 

In other words, listen to @Nancy OShea 👍


By @BenPleysier

 

All that l need is any code editor to start a new project, no dependency on any particular editor that no one else can understand what the code does , or bloated, limited components you will find in frameworks, you get the point. So if you are going to make suggestions at least follow them through yourself and use an editor and code which is universal for all.

 

Freedom without compromise, even professionals are starting to make a lot of noise about the use of third party bloated solutions and questioning how the hell has it come to this.

 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jun 11, 2022 Jun 11, 2022

I use a dwt file as a template so that I can apply changes to all webpages, at one time. Is there another way of doing this? 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 11, 2022 Jun 11, 2022
quote

I use a dwt file as a template so that I can apply changes to all webpages, at one time. Is there another way of doing this? 


By @default0vaokg78cv42

 

Server side includes are the professional approach to the problem but that comes when you 'grow up' and start producing websites properly, until then the approach that a beginner takes is largely unconsidered. It's a case of stumbling around in the dark. If you're serious about development things will become clearer, if you do this as a side gig they won't improve as you never learn anything beyond your limited knowledge.

 

Hopefully when you get onto your next website you'll at least use Bootstrap v5 and not v4 which you are currently using. No one should be producing a new website using v4 unless of course you're using an outdated editor like Dreamweaver, which hasn't included it yet and is not likely to as its minimally maintained these days or as l say you have no idea about web development and where we are currently at.

 

Of course v5 is extremely different to v4, perhaps another reason therefore not to depend on third party solutions because your always the puppet, not the puppet master

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 11, 2022 Jun 11, 2022
quote

I use a dwt file as a template so that I can apply changes to all webpages, at one time. Is there another way of doing this? 


By @default0vaokg78cv42

================

Below is a brief tutorial on PHP includes for sitewide elements -- i.e. headers, navigation and footers.   They are 100% more efficent than DW Templates.

https://alt-web.blogspot.com/2015/07/server-side-includes-with-php.html

 

Nancy O'Shea— Product User, Community Expert & Moderator
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jun 11, 2022 Jun 11, 2022

Bootstrap provides a level playing field that all developers can instantly recognize & understand.  When used properly, no guesswork is required.

 

Hybrids and rogue projects built by so called "code junkies" take too long to figure out. 

  • What logic (if there is any) went into it? 
  • What was this person thinking at the time? 
  • Is this just random garbage that was surreptitiously cobbled together for the developer's convenience? 

No developer in his/her right mind wants to be a forensics detective tasked with sleuthing out why a previous developer did what they did.

 

I don't even like picking up my OWN hand coded projects because while I know how I think TODAY, I've forgotten what I was thinking 10 years ago. 

 

That's not to say you can't build highly custom projects with Bootstrap.  You can.  But one must understand the medium first and then customize within Bootstrap's parameters.  Roads are more enjoyable when everyone follows the same traffic rules. The internet super highway is no different. 

 

Nancy O'Shea— Product User, Community Expert & Moderator
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 11, 2022 Jun 11, 2022
LATEST
quote

Bootstrap provides a level playing field that all developers can instantly recognize & understand.  When used properly, no guesswork is required.

 

By @Nancy OShea

 

Yawn........if you want to be part of that production line, virtually no skill involved, poor pay, every developer becomes disposable fodder, etc. Thats not hugley satisfactory in my eyes just being an interchangable number, have some pride and aim higher in life. Its the difference between coloring by numbers (no skill involved) and actually producing a bespoke painting. I know what provides more satisfation for me at least and its NOT just mind-numbingly reproducing others work. OK I accept in this day and age where we are in a race to the bottom some have zero choice and I have sympathy for them but to keep this diatribe going that  developers somehow enjoy wallowing around knee deep in inline styles and bloated html mark-up is just being indenial.

 

 

quote

 

Hybrids and rogue projects built by so called "code junkies" take too long to figure out. 

  • What logic (if there is any) went into it? 
  • What was this person thinking at the time? 
  • Is this just random garbage that was surreptitiously cobbled together for the developer's convenience? 

No developer in his/her right mind wants to be a forensics detective tasked with sleuthing out why a previously developer did what they did.

 

By @Nancy OShea

 

Geez html and css isnt that difficult to unravel........you can even mess Bootstrap up you know that, weve seen it here 1000's of times. If you dont have the basic skills to unravel someone elses html and css  then you shouldnt be calling yourself a developer. I dont know what to call those who just point and click and use plugins......robots without a brain programmed by those that do have a brain?

 

Does that mean you can't solve any other developers javascript code if asked? Do you think every javascript coder writes javascript exactly the same way.........go think again. Being able to understand code is what seperates the wheat from the chaff. 

 

quote

I don't even like picking up my OWN hand coded projects because while I know how I think TODAY, I've forgotten what I was thinking 10 years ago. 

 

By @Nancy OShea

 

 

Unless youre producing the very basic of websites it doesnt matter what you use, frameworks or hand coded, going back to a project months after you have produced it will always be difficult to undersatnd what you have done, that just the nature of the business. I assume you code bespoke back-end stuff don't you, which doesnt just pop out of a paper bag when you need it? The skill is being able to work through it and sort it out. Yes alright no-one wants to pay for your time but that's because youre working at the lower end of the scale and your clients dont respect your skills. That's the biggest mistake I made in my career, working for too many shite clients with no money. 

 

quote

 

That's not to say you can't build highly custom projects with Bootstrap.  You can.  But one must understand the medium first and then customize within Bootstrap's parameters.  Roads are more enjoyable when everyone follows the same traffic rules. The internet super highway is no different. 

 


By @Nancy OShea

 

Enjoyable......humm. I rather view it as having little skill and even less identity. I didnt ever want to be the same as the rest. I want to be better than the rest, not that I am but I try my best.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Jun 11, 2022 Jun 11, 2022

I take it you are a bootstrap fan! Dually noted. I started coding some CSS classes, because it was recommended in "Sams, Teach yourself bootstrap". It is fun to write some code, but it's taking too long.  I will use bootstrap exclusively when I do the second website. 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines