Types of CSS ( Cascading Style Sheet)
![]() |
Types of CSS ( Cascading style sheet) |
CSS stands for Cascading Style Sheets which is used for controlling you to create rules that specify how the content of an element should appear. Without using CSS it seems to bad impact on our web page therefore it is a prerequisite for us to learn CSS. Types of CSS are extremely important to know for us because we can make our website clean, faster, and professional which grabs the attraction of users.
There are three types of CSS which are given below:
- Internal CSS by using element of <style> in the <head> tag.
- External CSS by using <link> tag to link HTML file to external css file.
- Inline CSS by using the style attribute in the HTML elements.
Internal CSS
In Internal CSS you can include CSS rules within an HTML page by placing them inside an <style> element, which usually sits inside the <head> element of the web page. i.e the CSS is embedded within the HTML file. The <style> element should use the type attribute to indicate that the styles are specified in CSS.
Main points for Internal CSS
- Using the style for multiple web pages is time-consuming in that we need to place the style on each web page.
- When building a site with more than one page, you should use external CSS.
- Using Internal CSS in the HTML document will reduce the page size and loading of the webpage.
- An internal CSS is used to define a style for a single HTML page.
- Internal CSS is used in the condition when we want a style to be used in the complete HTML body.
Internal CSS with examples
External CSS
- href ---> This shows the path of the CSS file.
- type ---> It specifies the type of document to be linked. The value of this attribute should be "text/CSS".
- rel ---> This attribute shows the relationship between the HTML page and the file it is linked to. The value of this attribute should be "stylesheet" when linking to a CSS file.
Main points for External CSS
- There is no need to rewrite the CSS style again and again in a complete body of HTML.
- CSS style written in a separate file with .CSS extension and it should be linked to the HTML document using <link> tag.
- This type of style sheet gets a separate file in which developers can state every CSS style.
- The external CSS style sheet must be saved with a .CSS extension.
External CSS with examples
Main points for Inline CSS
- Using inline CSS we will have to give style attributes in every HTML element.
- We can create CSS rules on the HTML page.
- Inline CSS will affect only an HTML element.
- There's a lot of time will be consumed to use it.
0 Comments