About CSS

 What is CSS?


  • CSS stands for Cascading Style Sheets
  • CSS describes how HTML elements are to be displayed on screen, paper, or in other media
  • CSS saves a lot of work. It can control the layout of multiple web pages all at once
  • External stylesheets are stored in CSS files

"Css allows you to create rules that specify how the content of an element should appear. For example, you can specify that the background of the page is mint-cream,all the paragraph appear in Gray using the Arial typeface and headings should be in a blue and  italic."    


Css file:-



where 
p = Selector (which indicate the rule to applies.the same rule apply more than one element if you separate the element name with commas.)

{ color:gray;
     font-family:arial;  
}
Declartions (Indicate how the element referred to in the selector should be styled. Declaration are split into two parts 
  1.  Property
  2.   value
and separated by a colon.

Three way to insert css

● External style sheet
● Internal style sheet
● Inline style

There are several ways in which styles can be applied:

Inline:
<h1 style="color:blue;margin-left:30px;">This is a heading.</h1>

Internal:
<head>
<style>
h1 {
color: maroon;
margin-left: 40px;
}
</style>
</head>

External/ Linked:
<link rel="stylesheet" href="styles.css">

External Style Sheet:
With an external style sheet, you can change the look of an entire website by changing just one file!
Each page must include a reference to the external style sheet file inside the <link> element. The <link> element goes inside the <head> section

Internal:
An internal style sheet may be used if one single page has a unique style. Internal styles are defined within the <style> element, inside the <head> section of an HTML page

Inline:
An inline style may be used to apply a unique style for a single element. To use inline styles, add the style attribute to the relevant element. The style attribute can contain any CSS property.

Comments

Popular posts from this blog

Client Side Scripting Vs Server Side Scripting

The 5 Best WYSIWYG HTML Editors