0

hey i am a newbie in HTML world, and i am trying to make a simple html webpage with css in it but the webpage is just blank, please help me outand also there are no error in the console.

linking14.html

<html>
    <head>
    <link href="C:\Users\Manuj Srivastava\Desktop\html tutorials\css\linking14.css" rel="stylesheet" type="text/css">
                                        <!relation and accordingly type is set>
    </head>
    <body>
        <div id="div1"></div>
        <div id="div2"></div>
        <div id="div3"></div>
        <div id="div4"></div>
        <div id="div5"></div>
        <div id="div6"></div>
    </body>
</html>

and linking14.css

#div1{
    width: "300px";
    height: "200px";
    background: "firebrick"; <!#B222222>
} 
#div2{
    width:"300px";
    height:"200px";
    background:"skyblue";     
}
#div3{
    width:"300px";
    height:"200px";
    background:"slateblue";   <!#6A5ACD>
}
#div4{
    width:"300px";
    height:"200px";
    background:"firebrick" ;  <!#87CEEB>
}
#div5{
    width:"300px";
    height:"200px";
    background:"#1BE7FF";
        float:left;
}
#div6{
    width:"300px";
    height:"200px";
    background:"#052633";
        float:left;
}
7
  • did you link the css to html? Commented Feb 24, 2017 at 13:09
  • did you try to access the css directly from the browser? Commented Feb 24, 2017 at 13:10
  • download css, js file from w3cschool and link it to your .html file. For any problem , refer this link w3schools.com Commented Feb 24, 2017 at 13:10
  • @SalluSalman yes i did..!! Commented Feb 24, 2017 at 13:11
  • @GabrielChiHongLee yes i can access it..!! Commented Feb 24, 2017 at 13:13

8 Answers 8

2

Dont use quotes " " for css properties' values

#div1{
 
    width: 300px;
    height: 200px;
    background: firebrick;

}

#div2{
    width:300px;
    height: 200px;
    background:skyblue;     
}
#div3{
    width:300px;
    height:200px;
    background:slateblue;   <!#6A5ACD>
}
#div4{
    width:300px;
    height:200px;
    background:firebrick;  <!#87CEEB>
}
#div5{
    width:300px;
    height:200px;
    background:#1BE7FF;
        float:left;
}
#div6{
    width:300px;
    height:200px;
    background:#052633;
        float:left;
}
<div id="div1"> </div>
    <div id="div2"> </div>
    <div id="div3"> </div>
    <div id="div4"> </div>
    <div id="div5"> </div>
    <div id="div6"> </div>

Sign up to request clarification or add additional context in comments.

Comments

0

You shouldn't use the windows directory structure as the css link like

C:\Users\Manuj Srivastava\Desktop\html tutorials\css\linking14.css

It should be

./css/linking14.css

./ is current folder

Comments

0
<link>

This tag's src attribute should not use Windows file path conventions. Use a file path that is relative to your web server. I would not use spaces in file names or folders.

<link type="text/css" href="css\linking14.css" rel="stylesheet">

Comments

0

If your html file is on the same folder of css file, change your link to:

<link href="linking14.css" rel="stylesheet" type="text/css">

If is on subfolder "css", change your link to:

<link href="css/linking14.css" rel="stylesheet" type="text/css">

Comments

0

If this is supposed to be a comment

<!relation and accordingly type is set>

it should be

<!--relation and accordingly type is set-->

And i advice you put all you project files in a Folder for easy linking of css , scripts, images or nay other files

read here`

1 Comment

Yes, code with wrong syntax is generally ignored by HTML but can break it.
0

Link relatively to a subfolder with the css file and everything will be fine:

<link href="css\linking14.css" rel="stylesheet" type="text/css">

Just make sure linking14.html and css subfolder are in the same folder.

Also remember that this link is case-sensitive so if you name your css file "Linking14.css" you will also have to use capital L in the html file.

Comments

0

Try changing

<link href="C:\Users\Manuj Srivastava\Desktop\html tutorials\css\linking14.css" rel="stylesheet" type="text/css">

to

<link type="text/css" href="css/linking14.css" rel="stylesheet">

Also, use forward slashes. I would not use spaces in my file names, or directory names. Know what your webroot is. It helps when trying to specify relative paths to resources.

2 Comments

still nothing on the screen ..!! :(
code has been updated. please check. backward slash(\) changed to forward slash (/)
0

The Problem is that your values for your CSS properties are in quotes "".

#div4{
    width:"300px";
    height:"200px";
    background:"firebrick";
}

Needs to be:

#div4{
    width: 300px;
    height: 200px;
    background: firebrick;
}

Even though your CSS file is linked correctly, the CSS will not display because the quotes will produce an invlaid property value error when the CSS is loaded.

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.