0

im using appserver and i want to link style.css

.header {
    height: "40px";
    background-color: "red"
}

in my index.php

<html>
    <head>
        <META HTTP-EQUIV="Content-language" CONTENT="ar">
        <link rel="shortcut icon" href="img/favicon.ico"/>
        <link rel="stylesheet" type="text/css" href="CSS/style.css"/>
        <title>بام للسيارات | تبضع اينما كنت</title>        
    </head>
    <body>
        <div class="header">

        </div>
    </body>
</html>

but it didnt work i dont know why can someone help me

enter image description here

4
  • are you sure CSS/ diractory is correct? Commented Jun 29, 2013 at 0:32
  • Where is the CSS folder relative to the html file? Your current assumption is that your style.css file is inside a folder called CSS. Your HTML file is assumed to be in the same directory as the CSS folder Commented Jun 29, 2013 at 0:32
  • Add the directory structure of the website. Commented Jun 29, 2013 at 0:35
  • @A.S.Roma yes it's correct Commented Jun 29, 2013 at 0:35

2 Answers 2

4

Obviously your CSS is incorrect,

.header {
    height: "40px";
    background-color: "red"
}

Noticing the quotes in your values, which are invalid in CSS syntax. It should be,

.header {
    height: 40px;
    background-color: red;
}

After reviewing your code, there is no other coding errors. But your have serious errors with your file encodings.

index.php was encoded in UTF-16LE, and your didn't declare your charset in the <head> section nor the BOM (neither does your css file, which is encoded in UTF-8). So the browser guesses the resource files are also encoded in UTF-16LE, which read two bytes as one character. So your CSS became totally meaningless to the CSS parser, as it reads 栮慥敤⁲ൻ †栠楥桧㩴㐠瀰㭸਍††慢正牧畯摮挭汯牯›敲㭤਍ൽ.

So the fix is pretty straight forward,

  1. Add charset declaration at the begining of your <head>
  2. Save your index.php as UTF-8 encoding or add charset="utf-8" to <link>.
Sign up to request clarification or add additional context in comments.

2 Comments

Can you pack your code and upload it to dropbox or something, then post the link, so we can have a look?
@xiaoyi: Super... Hats off to that observation!
0

Use this

<html>
    <head>
        <META HTTP-EQUIV="Content-language" CONTENT="ar">
        <link rel="shortcut icon" href="img/favicon.ico"/>
        <link rel="stylesheet" type="text/css" href="CSS/style.css"/>
        <title>بام للسيارات | تبضع اينما كنت</title>        
    </head>
    <body>
        <div class="header">

        </div>
    </body>
</html>

I have packed your code ger it from here

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.