[SOLVED] From Codepen to Atom: different results on browser

[SOLVED] From Codepen to Atom: different results on browser
0.0 0

#1

Hello everyone. I was starting to build my Portfolio page but first I thought it would be better to get familiar with Atom so I could be better with it in the future.

It happens I just tried to do a bootstrap navigation bar by default, but I can’t get it to change colors on CSS. It works correctly on Codepen but it doesn’t on my browser. Tried both on my desktop and laptop and the problem persists.

The code is EXACTLY the same: http://codepen.io/philzx/pen/LxmXWN


#2

Are you loading Bootstrap? Have you linked your CSS file?


#3

It’s exactly as shown on Codepen, so the answer is yes…


#4

And you have your CSS file in the css folder, as specified by your link tag?


#5

Yes. That’s correct.


#6

There are only so many things that can possibly go wrong here. Check your browser console when you open your site and see what errors that gives you.


#7

That’s the most weird part. No errors at all…

http://imgur.com/cdf61wz


#8

Double check in network tab that bootstrap and css file loaded. Maybe try inlining your css with a style tag.

<html>
  <head>
    <style>
      // place your css here
    </style>
  </head>
  etc..

#9

I could check css file isn’t loading. Not sure why since the path is right.

Using a style tag it works though.


#10

What is your folder structure?

---project folder/
  ---index.html
  ---main.css

#11

My structure is:

---project folder/
  ---css/
    ---style.css
  ---index.html

#12

Maybe you’re loading your styles before you load Bootstrap. I see in your screenshot that you’re using Bootstrap but your navbar’s not colored (unlike in your codepen).


#13

Did you copy your code into Codepen, or are you downloading it from Codepen?


#14

You made a slight spelling error

<link ref="stylesheet" type="text/css" href="css/style.css">

Corrected

<link rel="stylesheet" type="text/css" href="css/style.css">


#15

Solved the problem with some help from one Facebook FCC Group user.

I had:

When it needed to be:

Thanks for your efforts.


#16

Of course, those silly little mistakes :smiley:


#17

This reminds me when I saved a html file as .txt and coudn’t make it work on browser for two days. Without thinking of googling.