KnowledgeBoat Logo
|

Computer Applications

What are three ways of creating style rules? Give examples of each.

CSS

10 Likes

Answer

The three ways of creating style rules are as follows:

1. Inline — Styles are embedded right within the HTML code they affect. For example,

<h3 style = "font.family = Arial ; color = red ">

2. Internal — Styles are placed within the header information of the web page and then affect all the corresponding tags on the page. For example,

<HEAD>
<STYLE TYPE = "TEXT/CSS">
h3 { font.family : Arial ; color : red ; }
</STYLE>
</HEAD>

3. External — Styles are coded in a separate document, which is then referenced from within the header of the actual web page. For example, let there be a CSS file named sample.css :

h3 { font.family : Arial ; color : red ; }

p { font.family : Times New Roman ; color : blue ; }

...and so on...

To link sample.css file to an HTML document, we use the <link tag in the following manner:

<HEAD>
<LINK REL = "STYLE SHEET" TYPE = "TEXT/CSS" HREF = "SAMPLE.CSS">
</HEAD>

Answered By

4 Likes


Related Questions