CSS (Cascading Style Sheets) is a declarative language for controlling the appearance of webpages in browsers. To display items properly, the browser applies CSS style declarations to them. The attributes and values that govern how a webpage appears are contained in a style declaration.
CSS stands for Cascading Style Sheets.
CSS and HTML work hand in hand:
One approach to insert a style sheet is to use an inline style. An inline style is a one-of-a-kind style that is applied to a single element. In order to use an inline style, add the style attribute to the relevant tag.
As example:
<p style="color:white; background-color: gray;" >
This is an example of inline styling. </p>
Internal styles are defined within the <style>
element, inside the <head>
section of an HTML
page.
An internal style sheet may be used if one single page has a unique style.
As example: this code styles all paragraphs
<html>
<head>
<style>
P {
color:white;
Background-color:gray;
}
</style>
</head>
<body>
<p>This is my first paragraph. </p>
<p>This is my second paragraph. </p>
</pody>
< / html >
With this method, all styling rules are contained in a single text file, which is saved with the .css extension.
This CSS file is then referenced in the HTML using the <link>
tag. The <link>
element goes inside the head
section.
as example:
Both relative and absolute paths can be used to define the href for the CSS file. In our example, the path is relative, as the CSS file is in the same directory as the HTML file.
The color property specifies the color of text.
CSS Syntax:
color: color|initial|inherit;