A cascading style sheet is used to set the style in web pages that contain HTML elements. It sets the background color, font-size, color, etc property of elements on a web page. There are three types of CSS which are given below:
- Inline CSS
- Internal or Embedded CSS
- External CSS
Inline CSS: Inline CSS contains the CSS property in the body section attached with element is known as inline CSS. This kind of style is specified within an HTML tag using the style attribute.
Output:
BICT koseli
Internal or Embedded CSS: This can be used when a single HTML document must be styled uniquely. The CSS ruleset should be within the HTML file in the head section i.e the CSS is embedded within the HTML file.
Example
Output:
BICTkoseli
A complete notes protal koseli for ICTians.
External CSS: External CSS contains separate CSS files that contain only style property with the help of tag attributes (For example class, id, heading, … etc). CSS property is written in a separate file with .css extension and should be linked to the HTML document using the link tag. This means that for each element, style can be set only once and that will be applied across web pages.
Example
HTML File
Below is the CSS file that is going to be linked with the above HTML file externally.
The link tag is used to lin the external style sheet with the HTML webpage. href attribute is used to specify the location of an external style sheet file.
CSS File
body { background-color:powderblue; } .main { text-align:center; } .BICT { color:#009900; font-size:50px; font-weight:bold; } #koseli { font-style:bold; font-size:20px; }
Output:
BICTkoseli
A complete notes portal koseli for ICTians.
0 Comments