Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
Example of embedded CSS
Place your CSS rules into an HTML document using the <style> element that is called embedded CSS. This tag is placed inside <head>...</head> tags. Rules defined using this syntax will be applied to all the elements available in the document.
Following is the example of embed CSS based on the above syntax:
<!DOCTYPE html>
<html>
<head>
<style media = "all">
body {
background-color: orange;
}
h1 {
color: yellow;
margin-left: 30px;
}
</style>
</head>
<body>
<h1>This is a heading</h1>
<p>This is a paragraph.</p>
</body>
</html>
The following is the attribute:
Attribute |
Value |
Description |
|---|---|---|
Type |
text/css |
Specifies the style sheet language as a content-type (MIME type). This is required attribute. |
media |
screen tty tv projection handheld braille aural all |
Specifies the device the document will be displayed on. The default value is all. This is an optional attribute. |
Advertisements
