HTML Styles

overview

Tag Styles


Tag styles are information that you provide in the tag that specifies how the tag should be displayed. In the followoing example, we specify that we want our div tag to have a height of 300 pixels and a background color of light green.


<div style="height:300px;background-color:lightgreen"> 

</div>
				
Try it!

Styles Tags/Sheets

The style of an HTML element can be set by creating style tags and including the style information within the style tags. However, when style information is included in tags, you need a way to reference which HTML elements the style applies to.

sample program

<style>
  .section{
	margin-left:200px;
	margin-right:200px;
	height:300px;
	background-color:lightgreen;
  }

</style>

<div class="section"> 

</div>
				
Try it!

Applied Styles


Contents