Web Analytics Made Easy -
StatCounter Newbie question - CodingForum

Announcement

Collapse
No announcement yet.

Newbie question

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Newbie question

    Hey so I have my Html and my CSS pages but don't know why they aren't linking Here is what I've got

    HTML
    <!DOCTYPE html>
    <html>

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


    <body>
    <div>
    this is a box
    </div>

    </body>

    </html>


    CSS
    div {
    width: 200px;
    height: 50px;
    border: 1px red;
    padding: 5px;
    margin: 2px;
    display: inline-block;
    text-align: center;

    }

  • #2
    both files have to be in the same folder

    try this ...

    css

    div {
    width: 200px;
    height: 50px;
    border: 1px solid red;
    padding: 5px;
    margin: 2px;
    display: inline-block;
    text-align: center;

    }
    Last edited by Shaka Zorba; Oct 3, 2016, 11:01 PM.
    we are all immigrants who face immanent deportation back to heaven

    Comment


    • #3
      <link rel="stylesheet" type="text/css" href="index.css">

      This line of code indicates that your index.css file is in a root folder of your website. foot folder is the place where your main index.html file is.

      if you placed your .css file in individual folder then you have to specify it in "href="...", for example if have folder named "css" next to your index.html file and in that folder you placed your index.css, then your link to that stylesheet should look like this:
      <link rel="stylesheet" type="text/css" href="css/index.css">
      WordPress - so much more then editing themes

      Comment

      Working...
      X