<style> - HTML CSS HTML Tag

HTML CSS examples for HTML Tag:style

Introduction

The style element sets CSS styles inline in your HTML document.

The style Element summary

Item Value
Elementstyle
Element Type N/A
Permitted Parents Any element that can contain metadata plus, head, div, noscript, section, article, aside
Local Attributes type, media, scoped
Contents CSS styles
Tag Style Start and end tag enclosing text
New in HTML5 No
Changes in HTML5 The scoped attribute has been added in HTML5
Style Convention None

Using the style Element

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
   <head> 
      <style type="text/css">
a {<!-- w  w w  .  ja  v  a 2 s.  c  o  m-->
   background-color: grey;
   color: white;
   padding: 0.5em;
}

      </style> 
   </head> 
   <body>
       I like 
      <code id="myId">HTML</code>
       and CSS. 
      <p></p> 
      <a href="http://java2s.com">Visit java2s.com</a> 
      <a href="page2.html">Page 2</a>  
   </body>
</html>

Related Tutorials