r/nekoweb • • 2d ago

Solved!! help with css plspls

so i used a layout generator to start off since this is my first time making something more official, i used petrapixels layout generator!!! i put both parts of the code into their respectable files, the html going into the index.html file & the css going into the style.css file but when i view my website the style parts don’t seem to be applied correctly and im so confused!!! 😭 i can’t figure out what it is i did wrong. i’ve tried a lot and at one point ended up accidentally deleting both my index html and style css files but i made new ones -_-

i included pictures of what the website SHOULD look like, and how it’s coming up. i’ll include a link to it as well. i just need help figuring this issue out :/ pls plss thank u

https://cookietin.nekoweb.org/

13 Upvotes

4 comments sorted by

7

u/asartalo 1d ago edited 1d ago

On your HTML file, the URL you used for including the css file is incorrect:

	<!-- CSS: -->
	<!-- You will have to change this to "../style.css" if this HTML file is in a subfolder, to "../../style.css" if this HTML file is in 2 subfolders, etc. -->
	<link href="html/cookietin.nekoweb.org/style.css" rel="stylesheet" />

Change "html/cookietin.nekoweb.org/style.css" to "https://cookietin.nekoweb.org/style.css" or better yet "/style.css" as in:

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

You also have some URLs used in href attributes that probably need fixing as well like the one for the favicon one. That one points to a file on your local PC instead of the web server it is supposed to be hosted.

→ More replies (1)

3

u/projectflamejewel 1d ago

In the HTML head, the link to your stylesheet is mistyped, which is why it's not being used.

<link href="html/cookietin.nekoweb.org/style.css" rel="stylesheet">
            ^---^ This should be "https://" if its a full link.

But since you're linking to one of your own files, you should just use a relative link, instead, since you won't have to change anything if your domain name changes.

<link rel="stylesheet" href="/style.css">
                             ^ The "/" means a path relative to
                               your site's root.

2

u/katanaism 1d ago

thank you for your help! it’s fixed now!