Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!

We spend hours on Instagram and YouTube and waste money on coffee and fast food, but won’t spend 30 minutes a day learning skills to boost our careers.
Master in DevOps, SRE, DevSecOps & MLOps!

Learn from Guru Rajesh Kumar and double your salary in just one year.

Get Started Now!

What is CSS and how many types of CSS?

CSS stand for cascading style sheets. By using CSS we can apply style to the html document. It provides an additional feature to HTML. It is generally used with HTML to change the style of web pages and user interfaces. It can also be used with any kind of XML documents including plain XML, SVG and XUL.

In CSS they are three way to write CSS.

  1. Inline
  2. Internal
  3. External

Inline CSS :

By using Inline CSS we can apply the style to the element by using style attribute inside the opening tag.

Example:

<!DOCTYPE html>
<html>
<body>

<h1 style="color: red; text-align: center;">This is a heading</h1>
<p style="color: black;">This is a paragraph.</p>

</body>
</html>

Internal CSS :

By using Internal CSS we can apply the style to the element by using style tag, Inside the head tag of html documents.

Syntax:

<style>
      tag name {
               property : value
               }
</style>

Example:

<html>
<head>
       <title>Documents</title>
<style>
      h1{
         color: red;
        }
       p{
         background color: yellow;
         text-align : center;
         }
</style>
</head>
<body>
<h1>Good After Noon</h1>
<p>Hello World</p>

</body>
</html>

External CSS :

By using External CSS we can apply the styles and formatting of a web page separate file, his separate file, typically named with a .css extension, is then linked to the HTML document using the <link> tag.

Example:-

External styles are defined within the <link> element, inside the <head> section of an HTML page:

<!DOCTYPE html>
<html>
<head>
	<title>My Webpage</title>
	<link rel="stylesheet" href="Mystyles.css">
</head>
<body>
	<!-- content of the webpage -->
</body>
</html>

CSS Comments:

CSS Comments are used to explain or clarify the purpose of code to other developers or to remind yourself of the code’s purpose later on. Comments are single or multiple lines statement and CSS comments start with /* and end with */, And it will be ignored by the browser.

For example:

<!DOCTYPE html>  
<html>  
<head> 
<style>  
p {  
    color: blue;  
    /* This is a single-line comment */  
    text-align: center;  
}   
/* This is a 
multi-line comment */  

</style>  
</head>  
<body>  
<p>Hi Welcome to Cotocus</p>  
<p>This statement is styled with CSS.</p>  
<p>CSS comments are ignored by the browsers and not shown in the output.</p>  
</body>  
</html>   

Related Posts

What is css and How css Works & Architecture?

What is css ? CSS stands for Cascading Style Sheets. It is a language used to style web pages. CSS can be used to control the appearance Read More

Read More

CSS Boarding Style:

We have eight style in CSS 2. dotted: This style creates a dotted line around the element. 3. dashed: This style creates a dashed line around the Read More

Read More

CSS Box Model

The CSS box model is a concept that describes how elements are laid out on a web page using rectangular boxes. Each box consists of four main Read More

Read More

Online Job Application Form Using Html and CSS

In this job application form we are using html and css. Output:–

Read More

CSS Selector and Its Types

What is CSS Selector Selector means choosing an html tag for applying the styles. CSS selectors can be based on the 1. CSS Element Selector: The element Read More

Read More

CSS Properties and its types

What is CSS Background CSS background property is used to set the background color, image, or other properties for an HTML element. Syntax: There are 5 CSS Read More

Read More
Subscribe
Notify of
guest
0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x