HTML style element

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

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

</style>
</>
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.

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.

Tag Attributes

Attributes that are applicable to <style> tag
type

This attribute contains the address or URL of the other pages.

<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?