1.What is CSS?

Cascading Style Sheets (CSS)is a stylesheet language used to describe the presentation of a document written in HTML or XML (including XML dialects such as SVG or XHTML). CSS describes how elements should be rendered on screen, on paper, in speech, or on other media.

3 ways of using css

  • Inline: using a style= attribute for single HTML elements inside <body>
<!DOCTYPE html>
<html>
<body>
<h1 style="color:blue;margin-left:30px;">This is a heading
</h1>
</body>
<p>This is a paragraph</p>
</body>
</html>
  • Internal: using a <style> element in the HTML <head> section
 <!DOCTYPE html>
<html>
<head>
<style>    
body {
    background-color:Blue;
}
h1{
   margin-left:30p
}
</style>    
</head>

<body>
<h1>This is aheading</h1>
<p>This is a paragraph</p>
</body>
</html>
  • External: using one or more external CSS files

In html file

 <!DOCTYPE html>
<html>
<head>
<link rel="stylesheet"
type="text/css"
hrel="mystyle.css" >
</head>
<body>
<h1>This is aheading</h1>
<p>This is a paragraph</p>
</body>
</html>

In mystyle.css file

p {background-color:Blue;}
h1{margin-left:30p;}

2.Element in CSS

We can reference the following page to get the detail about CSS element

results matching ""

    No results matching ""