HTML style element

Html style tag styles the content using CSS properties. CSS(Cascading Stylesheet Sheet) gives style to the sidebar, navbar and content.

Example

<style type="text/css"> 
	
  div{
	height:400px;
	width:100%;
	background-color:rgba(0,255,0,0.3);
	border-left:2px solid green;
	}

 </style>
</head>
<body>

 <div> 
  i am a div element i am designed by the css given in the style tag.
  my height is 400px.my color is light green and my border is green.
 </div>
Try </>

It is usually placed inside the head element.

Tag omission

Both opening and closing tags are necessary for the style element.

Global Attributes

All the global attributes are applicable on the style element.

Specific Attributes

AttributesDescription
type The type attribute represents the type of styling language.
<style type="text/css"> Here the properties of CSS are present </style>
media This attribute tells about which media type this style sheet applies to. For instance, screen, print, projection etc.
<style media="print"> Here CSS properties are applicable for print media </style>


Was this article helpful?

 

Email:

Message:

Get the newsletter