How To Use An Inline Style In An HTML Tag

How To Use An Inline Style In An HTML Tag
In this tutorial you will learn how to code an inline style for an HTML tag. You would use this type of style when you want to control a special area of your webpage differently from the way you have set the Cascading Style Sheets (CSS) for the rest of the webpage. Let's look at an example.

Basic Code

<tag style="property: value; property: value">text</tag>

<font style="color: #cfffff; font-family: arial">text</font>

As you can see, you will use the usual opening and closing HTML tags with one exception which is the addition of the inline style within the HTML tag.

style="color: #cfffff; font-family: 'comic sans MS'"

The code you add to create an inline style begins with the style attribute which is followed by an equal sign. On the right of the equal sign is one or more property:value pairs (style definition) between quotation marks. If you have more than one style definition, you separate each with a semicolon. Also notice the values that have spaces such as 'comic sans MS' are placed between single quotation marks.

♦♦If you are interested in creating a website with HTML, you might be interested in reading the HTML Basics Series which will teach you the basics of HTML as you build a simple three-page website and create a webpage template that you can use to add more pages to this site.

♦♦You might also want to try the Flash Basics Series that will walk you through the process of building a website with MacromediaR FlashR. If you are new to Flash or just need to refresh your skills, this is the place to start. This series of tutorials will give you the basic knowledge you will need to be able to create a simple Flash based website.

This site needs an editor - click to learn more!

Related Articles
Editor's Picks Articles
Top Ten Articles
Previous Features
Site Map

Content copyright © 2023 by Diane Cipollo. All rights reserved.
This content was written by Diane Cipollo. If you wish to use this content in any manner, you need written permission. Contact BellaOnline Administration for details.