answersLogoWhite
Internet Explorer
CSS Cascading Style Sheets
HTML

How do you use CSS?


Top Answer
User Avatar
Wiki User
2010-10-21 23:25:44
2010-10-21 23:25:44

CSS is easy to implement into any webpage. Three methods of insertion have proven to be the most common. The methods below need to have property replaced with the propetry or attribute you want to define, value with the value you want to replace, element with the element (usually an HTML or XML element) you want to define, and class with the class name of the element, if necessary. If you are defining styles for an element signified by an ID, put a number sign before the element name (no class, no period). ---- <html> <head><title>Testing!</title> <link rel='stylesheet' href='www.example.com/path/to/styles.css' /> </head> <body> ... </body> </html> Focus on the bold text. We have used the "style" tag, which defines style syntax that can be used on that specific page. ---- <body style='property:value; property:value;'> Alternatively, you can define specific propertys for a single element by putting it in its rightful tag as an attribute, as shown here. ---- <html> <head><title>Testing!</title> <link rel='stylesheet' href='www.example.com/path/to/styles.css' /> </head> <body> ... </body> </html>
There are two basic ways:

1) Create a style tag in between the <HEAD> and </HEAD> tag on your web page that looks like this:

<style type="text/css">

body{

background: #000000;

}

</style>

or:

2) Creat a new text file named yourFile.css(yourFile being whatever you want to name it) and place the file in the same folder as your web page. At the top put:

@charset "utf-8";

and something like this on the line after:

body, div, a{

border:0px;

margin:0px;

padding:0px;

}

Then put:

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

in between <HEAD> and </HEAD> on your webpage.

This explains the two main ways to add CSS to your page.

Related Questions

User Avatar

Inline CSS is one of the ways to apply CSS. It is the styling which is done with the individual element.

User Avatar

A CSS code allows you to modify your profile visually. There are articles in the MagiStream gamer forums that explain how and where you can use CSS codes.

User Avatar

CSS is used in web designing along with HTML. All the styling on the page is done only by CSS.

User Avatar

Mostly use Pseudo-elements in CSS for website designing.

User Avatar

You should always use your own CSS. This makes a person have control over what he is going to get.


Copyright © 2020 Multiply Media, LLC. All Rights Reserved. The material on this site can not be reproduced, distributed, transmitted, cached or otherwise used, except with prior written permission of Multiply.