By using this site you agree to the use of cookies.

Learn more

Share via:

Style - HTML Element

The style element of HTML is used to add styling rules, either embedded or external.

Edited: 2017-02-07 16:19

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");


AttributesOther AttributesGlobal, I18n, Event
typeContent TypeThe Content Type of the scripting language used.
mediaMedia DescriptorEither a single, or comma-separated list. I.e. "screen,print"
titleTextAdvisory title


<html lang="en">

    <title>My first Website</title>
    <style type="text/css">
      h1 {color:#0000FF;}
      p {font-size:2em;}

    <h1>My first use of Style</h1>
    <p>Using CSS to change the style of headings and paragraphs</p>