ExpertRating - Online Certification and Employment Testing ExpertRating - Online Certification and Employment Testing ExpertRating - Online Certification and Employment Testing

ExpertRating Home
ExpertRating Benefits
Recommend ExpertRating
Suggest More Tests
Privacy Policy
FAQ
Login
 
HTML Tutorial - Index
HTML Tutorial - Introduction
HTML Tutorial - Formatting
HTML Tutorial - Links
HTML Tutorial - Images
HTML Tutorial - Forms
HTML Tutorial - Tables
HTML Tutorial - Frames
HTML Tutorial - Style Sheets
HTML Tutorial - Advance Tags
     

 
Online Personal Trainer Certification
Personal Trainer Certification (Spanish)
Six Sigma Certification
Find a Personal Trainer
Project Management Certification
Six Sigma Certification
Six Sigma Black Belt Certification
Master Black Belt Certification
Six Sigma Green Belt Certification
Life Coach Certification
Lean Management Certification
Lean Six Sigma Certification
First Aid Certification
CPR Certification
Yoga Certification
Aerobics Certification
Pilates Certification
Business Analyst Certification
SEO Certification
Online Business Writing Course & Certification
Makeup Artist Certification
Baby Sitting Course & Certification
Time Management Certification
Health Club Management Certification
Medical Coding Certification
Medical Billing Certification
Business Analysis Course
Master Trainer Certification
Total Quality Management Certification
Kaizen Certification
Creative Writing Certification
Event Management Certification
Test Search by Job Title
Administrative Assistant Certification
Virtual Assistant Certification
  All Online Courses
   

   
   
   
   
   
   

   
  Home > Courses, Tutorials & eBooks > HTML Tutorial > Style Sheets
 
Previous Next

HTML Tutorial - Style Sheets

 
                                                                                                                     Page 2 of 4
 

Internal Style Sheets

Internal style sheets are to be used when a single document has a unique style. The internal styles are defined in the head section with the <style> tag (the style tag is explained in the last part of this section).

 

Example:

 

<head>

<style type=”text/css”>

body {background-color: red}

p {font-family : "courier new", courier}

</style>

</head>

 

Inline Styles

An inline style is used when a unique style is to be applied to a single occurrence of an element. To use the inline tag the <style> tag is used in the relevant tag. The style tag can contain any style sheet property. The following example shows how to change the color and left margin of a paragraph.

Example:

 

<p style=”color: red; margin-left: 20px” >

This is my jokes site.

</p>

 

 

Note:

In an HTML element, if all three style sheets are used then the order of preference is as follows: Firstly, inline style sheet will be used; secondly, internal style sheet; and lastly, external style sheet will be used. If style for an HTML tag has been defined in all the style sheets, then only the style of inline style sheet will be used.

Some tags associated with style sheets:

Link Tag

The link tag defines the relationship between two linked documents. This tag lets a style sheet to be linked to an HTML document.

Attributes of Link Tag

Href

In this attribute, the target URL of the resource has to be given. It means that the URL of the document has to be given; which is to be linked with the HTML document.

Type

Type defines the content type of the link tag. It takes up the value text/css. These two values are given together and separated by a slash (/). It means that either of these two values could be used.

Example:

 

<head>

<link href=”mystyle.css” type=”text/css” />

</head>

 

Rel

Rel defines the relationship between the current document and the targeted document. In this the value of rel should be given as stylesheet.

Example:

 

<head>

<link rel=”stylesheet” href=”mystyle.css” type=”text/css” />

</head>

 

Style Tag

The style tag defines a style in a document. The style tag is placed in the head section of an HTML document for an internal style sheet. The style element is also used with the HTML tag and it is placed inside that tag for inline style sheets.

For internal style sheets it is used as:

Example:

 

<head>

<style type=”text/css”>

body {background-color: red}

p {font-family : "courier new", courier}

</style>

</head>

 

 For inline style sheets it is used as:

Example:

 

<p style=”color: red; margin-left: 20px” >

This is my jokes site.

</p>

 

Attributes of Style Tag

Type

Type defines the content type of the style tag. It takes up the value text/css. These two values are given together and separated by a slash (/). It means that either of these two values could be used.

Example:

 

<head>

<style type=”text/css”>

body {background-color: red}

p {font-family : "courier new", courier}

</style>

</head>

 

   

 

 
     
Home  |  About Us  |  Privacy Policy  |  Site Map  |  FAQs  |  Contact Us
 
© ExpertRating 2015. All Rights Reserved.