Hi there, when I moved code and added the cdn for bootstrap in the head element of my html file, some bootstrap 3 commands did not “take”. For instance, making the nav bar and text-center commands. Tried putting cdn at bottom of list–with style.css above it. Still no success.
Any ideas of what I’m missing?? Looks like netbeans wants me to add more commands to the regular css file, but this shouldn’t be necessary with bootstrap, right?
Formatting is fine in codepen…
Thanks in advance for any help.
Make sure youre using the correct version of the bootstrap cdn or else it wont work. They are on bootstrap 4 now so using a bs4 cdn wont work properly on bs3
Am thinking maybe I need to put items in css separately in netbeans. In codepen, I could list a few attributes in a row and it took them all whereas that doesn’t seem to be the case with netbeans. I will do some more exploring.
Are you saying that most of bootstrap is working, but the text-center class is not? Pretty sure the text-center class has been called that since the dawn of time, so if that isn’t working then something isn’t right. Can you post your head code here, remember to use the correct code formatting.
Also, how are you running the file, did you try using a local server. I don’t really know netbeans but it’s super easy in VS Code using the Live Server extension.
Turns out Netbeans didn’t like the Bootstrap cdn I initially was using.
I found a solution. I switched to a newer bootstrap 3 cdn and it solved the problem automatically. I had to switch out bootstrap 3.3.1 cdn that I copied from w3school website to bootstrap 3.3.7cdn which also included integrity=“sha 382…” from freecodecamp website.
Now the code works fine. Seems having a more up-to-date cdn with integrity makes a difference.
Is there is reason why your using version 3 and not 4.
Bootstrap 4 is on my list to learn.
Have you ever run across code examples not working because you were using an older version of some type of code?
Well, there is a difference between v3 and v4 if that’s what you mean. You can look that the migration page to see some of the changes.