You are viewing our Forum Archives. To view or take place in current topics click here.
HTML coding questions ...
Posted:

HTML coding questions ...Posted:

nitro_portal
  • New Member
Status: Offline
Joined: May 29, 201410Year Member
Posts: 28
Reputation Power: 1
Status: Offline
Joined: May 29, 201410Year Member
Posts: 28
Reputation Power: 1
How can I link my index.html with my main.css file?

I have done <link rel="stylesheet" type="text/css" href="style/main.css"/> but it wont work?

What should I have in the main.css apart from stuff like body {
background:black;
}

Please help I 100% appreciate your help!
#2. Posted:
vJoeSwanson
  • Powerhouse
Status: Offline
Joined: Jun 10, 201014Year Member
Posts: 435
Reputation Power: 17
Status: Offline
Joined: Jun 10, 201014Year Member
Posts: 435
Reputation Power: 17
I have;

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

In my Code and it works fine, The code you need is;
<link rel="stylesheet" href="style/main.css"/>


Make Sure you Have a folder called "style" In the same place as "index.htm"
#3. Posted:
nitro_portal
  • New Member
Status: Offline
Joined: May 29, 201410Year Member
Posts: 28
Reputation Power: 1
Status: Offline
Joined: May 29, 201410Year Member
Posts: 28
Reputation Power: 1
vJoeSwanson wrote I have;

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

In my Code and it works fine, The code you need is;
<link rel="stylesheet" href="style/main.css"/>


Make Sure you Have a folder called "style" In the same place as "index.htm"


do i put man.css in the style folder
#4. Posted:
vJoeSwanson
  • Powerhouse
Status: Offline
Joined: Jun 10, 201014Year Member
Posts: 435
Reputation Power: 17
Status: Offline
Joined: Jun 10, 201014Year Member
Posts: 435
Reputation Power: 17
nitro_portal wrote
vJoeSwanson wrote I have;

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

In my Code and it works fine, The code you need is;
<link rel="stylesheet" href="style/main.css"/>


Make Sure you Have a folder called "style" In the same place as "index.htm"


do i put man.css in the style folder


Yeah, then it should work.
#5. Posted:
nitro_portal
  • New Member
Status: Offline
Joined: May 29, 201410Year Member
Posts: 28
Reputation Power: 1
Status: Offline
Joined: May 29, 201410Year Member
Posts: 28
Reputation Power: 1
vJoeSwanson wrote
nitro_portal wrote
vJoeSwanson wrote I have;

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

In my Code and it works fine, The code you need is;
<link rel="stylesheet" href="style/main.css"/>


Make Sure you Have a folder called "style" In the same place as "index.htm"


do i put man.css in the style folder


Yeah, then it should work.


it does not work so do you have skype?
#6. Posted:
Kyle93
  • Retired Staff
Status: Offline
Joined: Jun 25, 201013Year Member
Posts: 4,078
Reputation Power: 2628
Motto: https://www.thetechgame.com/Forums/t=7804 333/vote-for-tune-of-the-week-friday-nigh ts-lockdown-dj-sets.html
Motto: https://www.thetechgame.com/Forums/t=7804 333/vote-for-tune-of-the-week-friday-nigh ts-lockdown-dj-sets.html
Status: Offline
Joined: Jun 25, 201013Year Member
Posts: 4,078
Reputation Power: 2628
Motto: https://www.thetechgame.com/Forums/t=7804 333/vote-for-tune-of-the-week-friday-nigh ts-lockdown-dj-sets.html
Firstly, your code is wrong. You need to remove the ending "/"

So...

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


If it still does not work, follow these.

1) Make sure you have put it in the "head" tag and you close your head tag correctly.

2) Make sure your file structure is this
/
index.html
/style/
main.css

3) Make sure main is either lower or upper case in both ones

4) Make sure you close all correct tags

5) How are you testing to see if it works? Try inspect element then looking at the style sheet from in browser to see if it is linked correctly
#7. Posted:
iyop45
  • Prospect
Status: Offline
Joined: Apr 15, 201113Year Member
Posts: 614
Reputation Power: 83
Status: Offline
Joined: Apr 15, 201113Year Member
Posts: 614
Reputation Power: 83
Kyle93 wrote Firstly, your code is wrong. You need to remove the ending "/"


Unless the doctype declaration is stricly html4, the self closing tag isn't an issue.
#8. Posted:
Kyle93
  • Retired Staff
Status: Offline
Joined: Jun 25, 201013Year Member
Posts: 4,078
Reputation Power: 2628
Motto: https://www.thetechgame.com/Forums/t=7804 333/vote-for-tune-of-the-week-friday-nigh ts-lockdown-dj-sets.html
Motto: https://www.thetechgame.com/Forums/t=7804 333/vote-for-tune-of-the-week-friday-nigh ts-lockdown-dj-sets.html
Status: Offline
Joined: Jun 25, 201013Year Member
Posts: 4,078
Reputation Power: 2628
Motto: https://www.thetechgame.com/Forums/t=7804 333/vote-for-tune-of-the-week-friday-nigh ts-lockdown-dj-sets.html
iyop45 wrote
Kyle93 wrote Firstly, your code is wrong. You need to remove the ending "/"


Unless the doctype declaration is stricly html4, the self closing tag isn't an issue.


Completely correct, my apologies.

Only thing I'd note would be if he is having issues with linking a style sheet chances of him a) having a doctype or b) having a doctype thats going to cause problems, is quite high in my opinion.
Jump to:
You are viewing our Forum Archives. To view or take place in current topics click here.