Language References
Specifies inline styles. | HTML 4, 4.01, 5 |
HTML Syntax
<style
disabled
media = screen | print | all
title = text
>
The STYLE element defines an embedded style sheet that declare the styles for use within the current page.
Microsoft® Internet Explorer® 4.0 and later permit multiple style blocks. Netscape Navigator® 4.0 and later supports two types of style sheets: Cascading Style Sheets ( CSS ), the default, and JavaScript style sheets. To specify that the style sheet is JavaScript, the value of the type attribute is "text/javascript".
The STYLE element should appear in the HEAD section of an HTML document.
Please see Style Sheet Basics and Using Style Sheets for more information on using the STYLE element. The CSS Reference Table provides a complete list of the standard W3C CSS-2 style attributes.
style Members
This sample shows how to enclose style declarations in the STYLE element.
<head>
<style>
<!--
BODY { background-color: white; color: black; }
H1 { font: bold 18pt arial ; }
P { font: 10pt arial; text-indent: 0.5in; }
-->
</style>
</head>
<body>
<h1>This header will display in 18pt bold Arial
font</h1>
<p id="theSample">This paragraph will display in
10pt Arial font, and will be indented a half-inch
from its left margin.</p>
</body>
This sample shows how the STYLE object is accessed in client-side script [compliant with the ECMA-262 language specification], to change the font size of our paragraph object above.
theSample.style.fontSize=14
Using Stylesheets.aspx