0

I am trying to edit my HTML file called index.html using a css file called style.css which is located inside of /root/var/www/ and the html file i located in /root/var/www/html.

<!DOCTYPE html>
<html>
  <link rel="stylesheet" type="text/css" href="style.css">
<div class="body">
  <head>
    <title>Homepage</title>

I think its because they are in two different folders and i tried googling the problem which made me try using href="../style.css" which also did not work.

6
  • ../style.css should have worked. The link tag is self closing. You don't have the forward slash. Try adding that. Commented Feb 1, 2017 at 22:38
  • 1
    Do you have the <link> inside the head element? Commented Feb 1, 2017 at 22:42
  • 2
    <div class="body"> <head> is wrong Commented Feb 1, 2017 at 22:43
  • Yes, he needs to study proper html structure first! It is a mess. I assumed he typed out stuff really fast. That is the screenshot of his html. Commented Feb 1, 2017 at 22:43
  • @vcasso yes i do and im new first html project ever Commented Feb 1, 2017 at 23:05

2 Answers 2

1

Your html should be structured like this:

<!DOCTYPE html>
<html>
  <head>
    <title>Homepage</title>
    <link rel="stylesheet" href="../style.css">
  </head>
  <body>

  </body>
</html>
Sign up to request clarification or add additional context in comments.

1 Comment

You can also try href="./../style.css"
0

Your order and the hierarchy of tags is wrong: Start with <html> , then <head>, inside that put the link to the stylesheet (with href="../style.css"), but NO div yet, then close </head>, open <body> and then start with your DIVs etc., i.e. all the visible stuff. At the end close </body> and </html>

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.