WHAT IS CSS LANGUAGE
In today's blog, we will learn about CSS language, what is it and its use.
- The full name of CSS is Cascading Style Sheet. HTML and CSS have a big hand behind the technology of creating a webpage. CSS is a technology that helps us to make our website look more attractive.
- It describes how HTML elements are to be displayed on screen paper, or in other media.CSS control the layout of multiple we pages all at once and external style sheets are stored in CSS file.
- Many tags are used in HTML like header tag Paragraph tags , font tag , table tag , image tag etc. CSS is used together to make all these tags appear better in the browser.
- Using CSS, we can change the color or size of the test of our website. Also we can change the background color. There are many things that we cannot do in HTML.
CSS Syntax:-
Syntax defines the structure of any language. It is not possible to write functional code without rules. It becomes very easy to write its code or program, so any programming language or code is written in the syntax itself.
We write the syntax of CSS in this way -
- We use CSS selector, declaration, property name and property value to style the elements of HTML. We also use colon and semicolon to separate property name and value.
- A CSS declarations always ends with semicolon and declaration block are surrounded by the curly bracket ( {} ).
Note:- All CSS code is written between the head elements such as <head > and </head > under style tags such as <style > and </style >.
Lets see the example:-
<html>
<head>
<title>Syntax of CSS by todaygyan3blogspot.com</title>
<style>
p {
color: blue;
text-align: center;
}
h1 {
color: red;
text-align: center;
}
</style>
</head>
<body>
<p>
If you want to learn CSS code.
</p>
<h1>
CSS programming language.
</h1>
<p>
Welcome to my website.
</p>
</body>
</html>
Without using CSS code
After using CSS code
How to use CSS code in HTML:-
We can use CSS in HTML in the following way. Mostly we can do it in 3 ways -
- Inline CSS
- Internal CSS or Embedded and
- External CSS