Moving code from codepen.io to Netbeans IDE

Moving code from codepen.io to Netbeans IDE
0

#1

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.

Sally


#2

Hi there!

It’s a little hard to know from your comment - can you explain what you mean by ‘some bootstrap 3 commands did not take’? Taking a guess - are you using any Bootstrap components that require Javascript to work?


#3

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


#4

Using bootstrap 3 cdn. No javascript.
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.
Thanks


#5

Thanks. No javascript in code. I will do some more exploring and comparing code at w3schools.com and fcc and see if I can see anything different. Thanks!


#6

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.


#7

Hi lasjorg,

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.

I


#8

Is there is reason why your using version 3 and not 4.


#9

Bootstrap 4 is on my list to learn.
Thanks.
Have you ever run across code examples not working because you were using an older version of some type of code?


#10

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.