Web Design Stuff
HTML Tutorials    CSS Tutorials    Web Hosting   Resources
Create a Web Page 101
Making Web Pages Intro What is a Web Page? Why Make a Web Page? The History of HTML Learn HTML or XHTML?
Basic HTML
Basic HTML Tutorials Basic HTML Necessities How to Make a Web Page How to Edit a Web Page The Basics of HTML Tags Basic HTML Page Structure HTML Attributes
HTML Font Codes
HTML Font Codes Intro HTML Font Color Codes HTML Font Size Codes HTML Font Style Codes HTML Bold/Italic Codes Combining Font Codes
Formatting Text
Formatting Text Intro Making Paragraphs Miscellaneous Formatting Headings & Subheadings Creating Hyperlinks
Using Graphics
Using Graphics on the Web Add Graphics to Your Pages Graphics and Accessibility How to Align Graphics Page Color & Background Graphics as Hyperlinks Horizontal Rules
Creating Tables
HTML Tables Tutorials HTML Table Fundamentals Background & Border Color Table Frames & Rules Table Width and Alignment Cells 1 -Space & Alignment Cells 2 -Row Column Span Cells 3 -Width & Height
Making Lists
HTML Lists Tutorials Bulleted Lists Numbered Lists Definition Lists
HTML Frames
HTML Frames Tutorials Using Frames for Layout Advanced Frame Layouts Putting Hyperlinks in Frames Frame Border Width Color, Margin and Control Problems with Frames SmartFrames: A Solution SSI: An Alternative to Frames
Web Page Forms
Making Feedback Forms A Simple Feedback Form Installing NMS FormMail Debugging Your Setup My Web Host is Out to Lunch User Input Components Text Fields Checkboxes & Radio Buttons Dropdown Menus Push Buttons Layout and Presentation
Basic CSS
Basic CSS Tutorials What is CSS? Why You Should Use CSS How to Use CSS Inline Styles Embedded Style Sheets External Style Sheets Class Selectors ID Selectors Combining Selectors
CSS Properties
CSS Properties Intro Font Styles Width, Height & Spacing Borders Backgrounds Position Float & Alignment Hyperlinks
All About Web Hosting
Hosting Your Own Website What is a Web Host? Your Website's Home Page Building a Website Offline About Free Web Hosting Best Free Web Hosting Commercial Web Hosting How to Get a Domain Name Ecommerce Web Hosting Web Hosting Terminology
Free Web Design Tools
Best Free Website Tools Best Free Text Editors Best Free Graphics Editors Free Website Analysis Tools
Setting Up HTML Kit
HTML Kit Introduction How to install HTML Kit Screenshot Breakdown Basic Configuration Overall Appearance Shortcuts and Startup Editing Window Customizing Toolbars Using the Favorites Tab Making a New Actions Bar Odds and Ends
Free Templates
Free Website Templates Two Column Fixed Width Three Column Liquid Layout Miscellaneous Templates Dynamic Menu Effects Two Column Experimental Terms of Use About These Templates
Website Templates Help
Getting Started Template Zip File Download How to Edit Your Template What to Edit in the HTML How to Add Your Logo Making a Website
Web Design Tips
Web Design Basics Tables vs. Tableless Using Tables for Layout Example Table Layouts World's Crappiest Web Page
Twitter Backgrounds
Twitter Backgrounds Intro Cool Twitter Backgrounds Cool Twitter Backgrounds 2 Plain Twitter Backgrounds Dark Twitter Backgrounds Best Twitter Backgrounds Cute Twitter Backgrounds Music Twitter Backgrounds Music Twitter Backgrounds 2 Twitter Backgrounds 101 TERMS OF USE
All About Web Browsers
What is a Web Browser? Mozilla Firefox Internet Explorer Opera How to Set Up Firefox Top 5 Firefox Extensions
 
Contact
Post Some Feedback Send Me An Email Iron Spider Blog About Iron Spider... Site Conventions
 
 
 

 

Inline Styles

 
Using inline styles is the best way to start learning CSS as it applies the styling directly to individual HTML elements using the style attribute. This is a no-nonsense, self-contained method that is easy to visualize and leaves little room for error and therefore lends itself to experimenting with new CSS properties and values that you are not familiar with. Inline styles are also good for style declarations that you don't use very often and would just ultimately clutter up your embedded or external style sheets for no good reason.

Here's the syntax you use to create an inline style:

<element-name style="property: value;">

In the above:
  1. element-name refers to the targetted HTML element
  2. property refers to a CSS property
  3. value refers to an associated CSS value
Multiple CSS property/value pairs can be used in the same style attribute. This is demonstrated by the following syntax:

<element-name style="property: value; property: value; property: value;">

Here's a few things to remember about inline CSS syntax:
  1. The property and its associated value are separated by a colon (:)
  2. Each property/value pair ends with a semi-colon (;)
  3. When using multiple word values, the multiple word string must be enclosed in single quotation marks to avoid prematurely ending the style attribute (see below).

And to make CSS code easier to read, it's good idea to add a space after the colons and semi-colons.

Here's an actual example of an inline style which applies the color green and a 16 pixel font size to all the text enclosed in a set of paragraph tags:

Example 1 - SOURCE CODE

<p style="color: green; font-size: 16px;">It was a dark and stormy night.</p>


And this will produce the following effect:

Example 1 - RESULT

It was a dark and stormy night.



Here's an example of an inline style that contains a multiple-word CSS value (Times New Roman) enclosed in single quotation marks ('...'):

Example 2 - SOURCE CODE

<h1 style="font-family: 'Times New Roman';">Heading</h1>


Example 2 - RESULT

Heading



All HTML elements (with the exception of the script element) that are normally used in the body of a web page may employ the style attribute.

And that's about it.

Simple, no?

So exactly what CSS properties and values apply to which HTML elements? Well, here's my go-to list of CSS properties that were highly instrumental in the making of this site.


*   *   *


Of course the real power of CSS is the ability to apply the same style declarations to multiple HTML elements at once. So let's drill down a little deeper into the world of CSS and learn how to use embedded style sheets...





Best Free Stuff
for webmasters

Free Text Editors
Free Graphics Editors
Website Analysis Tools
Free Website Templates

See also:

Best Free Web Hosting
How to Make a Web Page

 

If you need a .COM web address, you can get one quick and easy at...

www.GoDaddy.com
<~ BACK TOP NEXT ~>
 
HTML Tutorials |  CSS Tutorials |  Web Hosting |  Domain Names |  Web Design Resources
Iron Spider © Copyright 2004-2011 Robert Darrell