Link


#1

Hi guys!

Need some assistance please. I’m learning and building at the same time. I am struggling to link my CSS file to my HTML file. I have used the following code:

But it won’t work. Clearly I am doing something wrong.

I am coding using Sublime Text, and have created and saved the website file with both HTML and CSS files together.

What am I missing?

Thanks :slight_smile:


#2
<link rel="stylesheet" type="text/css" href="main.css"/>

#3

is your css file named main, is it a css file and in the same folder as the html file?

if the answer to all these 3 questions is yes, please upload the files (dropbox, google drive, whatever you prefer) and share the files here on the forum. Then i can have a look


#4

To be honest I am a bit hesitant to share my file, I’m building something unique… could it be that I’m previewing the file on Safari and should use Chrome instead?


#5

Yes to all three questions


#6

File is called: main.css
I saved into the same folder with the the HTML pages on my desktop.


#7

then please share the directory with me so i can have a look, its the only way i can help you

If you want to keep your html source code a secret, you can never publish (go live) with your website. Code of html & css of a website can be viewed


#8

Not worried about the code just what the code makes :wink: But I will share it cause I’m getting frustrated and can’t continue my learning or building.

How do I share the directory exactly, Stetim94?


#9

the entire html source code can be viewed, all of it.

the forum this not support this, you will need to use an external cloud service like google drive, dropbox or whatever tool you know/feel comfortable with


#10

I understand. I’m sure it will be safe.

I will be honest this may seem naive but I wouldn’t know where to even begin. I would prefer to use google drive, how would I create this file on google drive, then where do I sent it to? via email. Please help.


#11

you can go to google drive:

https://drive.google.com

then in the left corner select: new -> upload folder (not sure what it says, mine is not set to english). Once the folder is uploaded, i think you need to right click the directory to share it.

But as a programmer, figuring out google drive shouldn’t be a problem


#12

https://drive.google.com/open?id=1QE1BVLbFANG6MBn9KCMvoCYpoBAk5uxq

Very simple, thank you. Will await your response.

Appreciate the help.


#13

the css file is empty? Once i add css code to the file, it works fine?

one tip, i would avoid inserting spaces in your file names, use underscores instead of spaces.


#14

Thank you for the tip. Sorry I was in meeting. I have corrected the CSS file and see my error. Thank you for your help.

Have a great day/evening further


#15

Just a final question, if I wanted a specific color for CSS, its a different shade of orange. How would I get the Hexadecimal color code or RGB color code.

Thanks again


#16

have you you updated the same folder on google drive? The css file still looks empty


#17

No need to update it, I have found the error.


#18

just a mistake in the css file? So all good now?


#19

Can I ask another unrelated question to the CSS one? it has to do with linking?


#20

sure, what is your question?