o Time
Saver- Writing CSS code saves our
time as we can do global changes easily .
o Page
loads faster-
We are not considered to write HTML tag attributes every time, if we are using
CSS. So, less code means our page will load faster.
o Superior
styles to HTML-
Array of attributes in CSS are wider than HTML, that gives a better look to the
page.
oMaintenance becomes easy- If you want to make a
change globally, just change the style and changes will be done in all the web
pages.
o Multiple
device permittance- CSS allow content to be optimize for various types of devices. It make
the pages compatible to different devices and browsers.
o How we write
code in CSS/Use-
External Style Sheet- is used when we want to apply style to
multiple pages. Each of the pages must link to style sheet by using
<link> tag.
Internal Style Sheet- It should be
used when we want to style single document. They are defined in head section.
Inline Style Sheet- means style
sheets inside the HTML element. It has the highest priority, means it overrides
the style attribute written inside the <head> tag.
CSS syntax- is divided
into 3 parts i.e. selector, property and
value. Selector is basically the HTML element/tag that we want to style and
property is the attribute that we want to change.
And the
property is given value. The property and value are surrounded by curly braces
and separated by a colon (:).
selector {property:value} |
body {color:yellow} |
h1 {font-family: “Arial”} |
Different types of selectors-
The
type selector- |
h1{ color #36CFFF; } |
The universal selector |
*{ color #000000; } |
The class selector |
.black
{ color #000000; } |
The ID selector |
#black
{ color #000000; } |
The child selector |
body>p
{ color #000000; } |
The attribute selector |
Input[type=
“text”]{ color #000000; } |
CSS links- Links can be styled using CSS. Here we have four different
link stages -
Ø Link (unvisited
)
Ø Visited
Ø Hover
Ø Active ( on
which text user is clicking)
Above stages
must come in this order as shown above.
<style
type= “text/css”> a:link{color:blue} a:visited{color:green} a:hover{color:puple} a:active{color:red} </style> |
Comments
Post a Comment