Style - HTML Element
The style element of HTML is used to add styling rules, either embedded or external.
1286 views
Edited: 2019-11-03 04:39
The HTML style Element is used to embed styling rules directly in a page, or load external styling rules, (such as CSS StyleSheet). The rules contained in a style element are used to control the appearance and layout of a page.
External StyleSheets are normally added with the link element in the head of a page, but can also be added using a @import rule. I.e.:
<style type="text/css">
@import url("/style.css");
</style>
Attributes
Attribute: | Value: | Description: |
Attributes | Other Attributes | Global, I18n, Event |
type | Content Type | The Content Type of the scripting language used. |
media | Media Descriptor | Either a single, or comma-separated list. I.e. "screen,print" |
title | Text | Advisory title |
Example
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
<title>My first Website</title>
<style type="text/css">
h1 {color:#0000FF;}
p {font-size:2em;}
</style>
</head>
<body>
<h1>My first use of Style</h1>
<p>Using CSS to change the style of headings and paragraphs</p>
</body>
</html>
Tell us what you think: