CLASS X Cascading style sheet INLINE INTERNAL EXTERNAL

 What is cascading style sheet?

Ans1. CSS is an acronym for cascading style sheet is a programming specification markup language used for web development. It is a style sheet language which is used to describe the look and formatting of a document written in markup language. It provides an additional feature to HTML. It is generally used with HTML to change the style of web pages and user interfaces. 

2.       What is CSS used for?

Ans2. CSS (Cascading Style Sheets) is used to style and layout web pages — for example, to alter the font, color, size, and spacing of your content, split it into multiple columns, or adds animations and other decorative features.

3.    What is the difference between selector and declaration?

Ans3. The selector specifies the HTML element you want to style. The declaration block contains one or more declarations separated by semicolons. Each declaration includes a CSS property name and a value, separated by a colon.

For example:-   h3 {color:green, font-size:10px;}

Selector Property Value Property Value

Methods of Applying CSS

1. Inline:- In this method styles are embedded inside the HTML tag.

2. Internal:- In this method styles are placed within the header information of web page.

3. External:- In this method styles are coded as separate documents which is then referenced

from within the header of the web page..


CSS- CASCADING STYLE SHEETS


INLINE STYLES


Inline Style Sheets are included with HTML document i.e., they are placed inline with the

element. To add inline CSS, we have to declare style attribute which can contain any CSS

property. In inline Styles, declaration is enclosed in double quotes. The syntax is as follows:

<H1 STYLE= “COLOR: RED”>-------</H1>

PROGRAM TO SHOW WORKING OF INLINE STYLES

HTML

<html>
<head>
<title>CSS</title>
</head>
<body>
<h1 style="color: red;">COMPUTER</h1>
<p style="color: blue;">
A computer is an electronic machine that works under the instructions given by you
</p>
</body>
</html>


OUTPUT 


INTERNAL STYLES


Internal Style Sheets are useful if website consists of a single page because you can change

both style rules and HTML in same file. Internal styles are defined within the <STYLE>

element, inside the <HEAD> section of an HTML page. 

The syntax is as follows:

<HEAD>

<STYLE TYPE= “text/css”>

H1{color:red}

</STYLE>

</HEAD>

PROGRAM TO SHOW WORKING OF INTERNAL STYLES

<HTML>

<HEAD>

<TITLE>CSS</TITLE>

<STYLE>

H1 {color: blue;}

BODY {color: red;}

</STYLE>

</HEAD>

<BODY>

<H1> COMPUTER</H1>

A computer is an electronic machine that works under the instructions given by

you

</BODY> </HTML>


EXTERNAL CSS

HTML(save with .html extension)

<html>
<head>
<title>CSS</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1>COMPUTER</h1>
<p>
A computer is an electronic machine that works under the instructions given by you
</p>
</body>
</html>


The External CSS File (style.css)
CSS
h1 {
    color: red;
}

p {
    color: blue;
}

Comments

Popular posts from this blog

TYPES OF HARDWARE CLASS IX

CLASS 8 INTRODUCTION TO JAVASCRIPT

Computer Applications Class IX Types of Software (Chap 3)