Skip to content
Sign upLog in
This post is read-only. Explore Repls and connect with other creators on Community.View Community
The info in this post might be out of date, check out our docs instead. View docs
5

css not working

CamelGuy
CamelGuy

Hello. I am making a chat box for myself and my friends. When I run the html without css, I get what you see to the side. The same thing happens when I add any css to it. Any solutions on how to get the css to appear when the application is ran?

3 years ago

Voters

Comments

TopNew
9
hyperupcall
hyperupcall

hi!

because that is an 'HTML, CSS, JS', repl, i would recommend removing the php declaration text and php code from your index.html; the php code will not work.

relevant to your styling issue, you reference your css as such:

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

it does not work because you have no directory called css with a style.css in it.
you can fix it by creating a directory and placing your css in there, or renaming your href reference

you can use any of the options

@Geocube101
mentioned to update your href (without changing the name of any files or creating any folders)

  • href='/style.css' and href='//style.css' work because your style.css is at the root of your directory

  • href='style.css' and href='./style.css' work because both your index.html and style.css file is in the same directory.

3 years ago
3
CamelGuy
CamelGuy

@eankeen
Thanks! It worked!

3 years ago
3
Geocube101
Geocube101

try

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

or

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

just to be sure

<link rel='stylesheet' type='text/css' href='./style.css' />
3 years ago
1
CamelGuy
CamelGuy

@Geocube101
Your suggestion was the same as eankeen's suggestion, so your solution worked too! I appreciate the help!

3 years ago
Load more