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

To make a web page beautiful, we have to do css, example like we paint color to make our house look beautiful, in the same way css kar to make the site look beautiful.

You can write the css in <style></style> code, or you can write the css in a separate file and then you can get it included in your webpage.

CSS Example 1

<!DOCTYPE html>
<html>
<head>
<style>
body {
  background-color: lightblue;
}

h1 {
  color: white;
  text-align: center;
}

p {
  font-family: verdana;
  font-size: 20px;
}
</style>
</head>
<body>

<h1>My First CSS Example</h1>
<p>This is a paragraph.</p>

</body>
</html>

HTML
Here we have written the css in the style tag,
this code output  :-

 CSS Example 2

<!DOCTYPE html>
<html>
<head>
<link type="text/css" rel="stylesheet" href="https://www.google.com/cse/static/element/54e62135847a1703/default+en.css">
</head>
<body>

<h1>My First CSS Example</h1>
<p>This is a paragraph.</p>

</body>
</html>

HTML

 

 


How to write css code

  • You can use style tag to write css.
  • If you want to change the background color of the web page, then you have to css in the body tag.

Example:-

<!DOCTYPE html>
<html>
<head>
<style>

</style>
</head>
<body style="background-color: yellow;">

<h1>My First CSS Example</h1>
<p>This is a paragraph.</p>

</body>
</html>

 

HTML

This code output

Leave a Reply

Your email address will not be published. Required fields are marked *