Skip to content Skip to sidebar Skip to footer

css syntax with example

     CSS (Cascading Style Sheet) used to apply extra style to html elements, like change color, width, height and more options are there Click Here to Know more about CSS.
    Basically the css syntax is defined as shown below

Syntax 1(Internal or External CSS) :-


Css syntax



   The above syntax is used to define the Internal css or external styles for html elements.
Example:-
<html>
<head>
<style>
.SampleClass
{
 color:red;
}
#samplediv
{
 background:blue;
}
</style>
<body>
 <div class="SampleClass">Class style is apply here</div>
<div id="samplediv">sample div class is apply here</div>
</body>
</html>

Syntax 2(Inline Css):-

 The above syntax is used to define inline css style

Example:-
-----
-----
<body>
<div style="color:white;background:black;">Hi! I have white letter and black background color</div>
</body>
-----
-----




Example Program:- (Editor)



Output:-



Advertisement


Screen Shots:-

Post a Comment for "css syntax with example"