Web Designing Tips

If You Can Watch This, So Can Your Customers

Place Your Ad Here

 

 

Share This Website

Yocto Recommendations

Buy Best Selling Web

Development Products

Amazon.com Widgets

 

Yocto Promotions On

Top Featured Products

Superb web hosting

 

One-way backlinks for higher rankings! linkvana.com

 

Find a sponsor for your web site. Get paid for your great content. shareasale.com.

 

www.yocto-web-development.com

A Place To Learn And Find Everything Necessary For Best Web Business Development

Learn HTML Styles

CSS is used to for html styles.

learn html


Buy Our Top Recommended Guide: Head First HTML with CSS & XHTML

Look! HTML Styles and colors

This text is in Verdana and red

This text is in Times and blue

This text is 30 pixels high

 


Styling HTML with CSS

CSS was introduced with HTML 4, to provide a common way to style HTML elements.

CSS styling can be added to HTML in the following ways

  • in separate style sheet files (CSS files)
  • in the style element in the HTML head section
  • in the style attribute in single HTML elements.

Using the HTML Styles Attribute

It is time consuming and not very practical to style HTML elements using the style attribute.

The preferred way to add CSS to HTML, is to put CSS syntax in separate CSS files.

However, in this HTML tutorial we will introduce you to CSS using the style attribute. This is done to simplify the examples. It also makes it easier for you to edit the code and try it yourself.

Buy An Excellent Guide: HTML, XHTML, and CSS, Sixth Edition


HTML Styles Example - Background Color

The background-color property defines the background color for an element:

Example
<html>

<body style="background-color:yellow">
<h2 style="background-color:red">This is a heading</h2>
<p style="background-color:green">This is a paragraph.</p>
</body>

</html>


HTML Styles Example - Font, Color and Size

The font-family, color, and font-size properties defines the font, color, and size of the text in an element:

Example
<html>

<body>
<h1 style="font-family:verdana">A heading</h1>
<p style="font-family:arial;color:red;font-size:20px;">A paragraph.</p>
</body>

</html>

The style attribute makes the old <font> tag obsolete.

Buy A Great Guide: HTML, XHTML and CSS All-In-One For Dummies


HTML Styles Example - Text Alignment

The text-align property specifies the horizontal alignment of text in an element:

Example
<html>

<body>
<h1 style="text-align:center">This is a heading</h1>
<p>The heading above is aligned to the center of this page.</p>
</body>

</html>

The style attribute makes the old "align" attribute obsolete.

Buy Another Great Guide: Build Your Own Web Site The Right Way Using HTML & CSS, 2nd Edition


Deprecated Tags and Attributes

In HTML 4, several tags and attributes are deprecated. Deprecated means that they will not be supported in future versions of HTML and XHTML.

The message is clear: Avoid using deprecated tags and attributes!

These tags and attributes should be avoided:

Tags Description
<center> Deprecated. Defines centered content
<font> and <basefont> Deprecated. Defines HTML fonts
<s> and <strike> Deprecated. Defines strikethrough text
<u> Deprecated. Defines underlined text
Attributes Description
align Deprecated. Defines the alignment of text
bgcolor Deprecated. Defines the background color
color Deprecated. Defines the text color

For all of the above: Use html styles instead!


HTML Lessons

HTML Basic
HTML Elements
HTML Attributes
HTML Headings
HTML Paragraphs
HTML Formatting
HTML Styles
HTML Links
HTML Images
HTML Tables
HTML Lists
HTML Forms
HTML Frames
HTML Iframes
HTML Colors
HTML Colornames
HTML Colorvalues
HTML Quick List

HTML Advanced

HTML Doctypes
HTML CSS
HTML Head
HTML Meta
HTML Scripts
HTML Entities
HTML URLs
HTML URL Encode
HTML Webserver
HTML Summary


HTML References

HTML Tag List
HTML Attributes
HTML Events
HTML Colornames
HTML Colorpicker
HTML Character Sets
HTML ASCII
HTML ISO-8859-1
HTML Symbols
HTML URL Encode
HTML Lang Codes
HTML Status Codes

Quick links

Yocto Guide

Yocto Store

Yocto Updates

Yocto Forum

Yocto Links

Contact Us

 

top ecommerce sites
only search yocto web development

Join Yocto Forum And Share Your Views And Comments On Any Web Development Topic With The World web dev