Types of CSS
Types of CSS
- Inline style
- Internal style sheet
- External style sheet
Inline style
<tag_name style=“Property_Name:Value; “>
Example:
<P style=“Font-size:18px;”>
text
</p>
Internal style sheet
<head>
<style type="text/css">
selector{
Property : value;
Property : value;
}
</style>
</head>
Example:
<html>
<head>
<style type="text/css">
h1 {color: green}
h2 {color: #dda0dd}
p {color: rgb(0,0,255)}
</style>
</head>
<body>
<h1>This is header 1</h1>
<h2>This is header 2</h2>
<p>This is a paragraph</p>
</body>
</html>
External CSS:
Create a .css file that contain the only css script and link it into .html or . php page based on requirement.
<head>
<link type=”text/css” rel=”stylesheet” href=”css_filename.css”>
</head>
Example:
File name Style.css
P
{
Color:red;
}
Html file:
<html>
<head>
<link type=”text/css” rel=”stylesheet” href=”style.css”>
</head>
<body>
<p>cs-tutorial is a best website for html tutorial</p>
</body>
</html>
Qus. 1 : Which is not a valid CSS type?
- Inline
- External
- Outline
- Embedded (Internal)
- It is a separate document that contains CSS rules
- It separates content from the presentation but both are still contained in a single file
- It separates the content and style into separate files
- It allows a web designer and a content author to work in parallel