Jump to content

newbie help required


s4salman

Recommended Posts

Dear

i m newbie in css. I learnt somewhere to use external style sheet. i want to set web page body color, font size, font color, link color ( for links on black background) and link color 2 ( for links on white background color).

can any body tell me how to write this in css.

Link to comment
Share on other sites

here are the basics to CSS:

 

create a new file, call it style.css. then link to that file as shown below:


<html>
<head>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>
</body>

</html>

 

Then, inside your CSS, edit your brackets as such:

 


body {

background:#YOURBGCOLOR;
text-align:center;
color:#FF0000; /*makes the font color red */

}

 

To edit brackets, add classes and id's to them. Remember, though, that ID's are only to be used ONCE per document, and CLASSES are to be used more than once:


<html>
<head>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>

<div id="frame">some text in our frame</div>

</body>

</html>

 

then, add it to your CSS:

 


body {

background:#YOURBGCOLOR;
text-align:center;
color:#FF0000; /*makes the font color red */

}

div#frame { /* the hash represents the ID */

background:none;
text-align:center;
float:center;
position:static;

}

 

Now if you were to use it more than once, you'd make it a class, as shown below:

 


<html>
<head>
<link href="style.css" rel="stylesheet" type="text/css" />
</head>
<body>

<div class="frame">some text in our frame</div>
<div class="frame">some text in our frame again</div>

</body>

</html>

 

then, add it to your CSS:

 


body {

background:#YOURBGCOLOR;
text-align:center;
color:#FF0000; /*makes the font color red */

}

div.frame { /* the period represents the class */

background:none;
text-align:center;
float:center;
position:static;

}

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.