1.

Solve : Externale css help?

Answer»

When I make my   .css file   for my Externale css am I right I do the code LIKE this?


]
body-color=black
text-color=white
]


And I SAVE this file as
roberts.css

Then when I make my first Page I put this code in the Head Tag


And when the First page is LOADED into the Browser it will look at the   roberts.css file   for how to make the Text and Body color? Quote

am I right I do the code like this
No. See here: http://www.w3schools.com/css/default.asp

Quote
And I save this file as
roberts.css

Then when I make my first Page I put this code in the Head Tag
<link rel="stylesheet" type="text/css" href="roberts.css"/>
This bit is correct.Not this:

Code: [Select]<HTML>
]
body-color=black
text-color=white
]
</html>
this:

Code: [Select]body {
    background-color: black;
    color: white;
}

Here's a good place to go for reference: http://www.w3.org/TR/CSS21/#minitocWell I think I get it but let me start small.

I will just put the code to change the Text and Body Color.

In the   roberts.css file   I would type

{
body-color=black
}
text-color=white
}

Is this right?NO. Read the posts above.Honestly, i dont see much of a need to use CSS for such a simple style that can be done using HTML directly. Its one less file to worry about anyway.

But assuming that you still want to do this using CSS, you must define the "Body" before your properties.

In CSS, the tag that you use "body" refers to the HTML tag , The CSS code that you use to style it will apply to everything between and

so, as a seperate "filename".css file, the code would be as such posted above.

However, if you want to integrate your CSS into the HTML webpage itself, you would do this:
(doing so means it does not require the stylesheet file)

Code: [Select]<style type="text/css">
body {
    background-color: black;
    color: white;
}
[code]
</style>

You probably have figured it out, considering that the topic is old, however, i would like to post for anyone else who also wants to know. Quote from: zeroburn on APRIL 22, 2012, 07:08:42 PM
Honestly, i dont see much of a need to use CSS for such a simple style that can be done using HTML directly.

http://duckduckgo.com/?q=why+it+is+best+practise+to+use+CSS

Using external css is extremely important when you have a website with large number of pages. If you don't use external css file, then if in future u would have to change the styles of your pages, you gonna have to go through every page.
  Now to answer the main question of nymph4, i think this will help.

Your CSS File

Code: [Select]charset "UTF-8";

body
{
background-color:Black ;
color: white;
}

save it as you wanted to, i.e "roberts.css"

 Your HTML file

Code: [Select]<html>
<head>

<title>Motsim</title>

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

</head>

<body>
Here is your Content.
</body>
</html>

    This is how you do it. Hope this helps.
                                                                 Regards,
                                                                   MotsimThere is that truth.


Discussion

No Comment Found