CSS styles not showing in webview

Dear Replit Community,

For some reason I don’t know of because I’m a beginner, I am not able to see the styling of the html code in the preview of the site when the styling is in the style.css file. But when I view it in a new tab, the code works perfectly. I don’t know if this is just a bug or intentional. Thanks for your help.

Here is the repl link: https://replit.com/@notwonderful/webcreation

Hey @notwonderful welcome to the forums!

When linking the style sheet try using ./style.css instead of /style.css. The ./ shows that the file is in the same directory (or folder) as the HTML file.

I also noticed that you missed a dash between font and family, it should be font-family

1 Like

That shouldn’t change anything, it’s still a valid path.

You seem to have the HTML file in a folder, you should have the index.html outside of that folder. Then your path should be: css/style.css.

As @SharkCoding said, you missed a hyphen (-) in font-family, but you also missed a semi-colon (;) after you specify the font-weight (font-weight: bold;, semicolons cannot be left out in CSS unlike in JavaScript).


In the HTML did you link the CSS to it? Doing this allows the HTML to access the CSS and use it. I hope this helps :slight_smile: !

1 Like