CSS, How to, should you use ID or Class?

August 5th, 2009

Should you use id or class? Classes can be used as many times as needed within a document. IDs can only be applied once within a document. If you need to use the same selector more then once, classes are a better choice. However, IDs have more weight then classes. If a class selector and ID selector apply the same property to one element, the ID selector's value would be chosen.

CSS, What is a div

August 4th, 2009

The <div> elements is a generic container that can be used to add structure to an HML document. Although it is a block level element, it does not add any other presentation to the content. In many of the examples on this site the <div> element has been used to contain logical division of conent, such as navigation and footer information Read More...

CSS, How To – Shorthand Properties

August 2nd, 2009

The background property combines background-color, background-image, background-repeat, background-attachment, and background-position. h1 { border: 1px solid gray; background: yellow url(tint.jpg) repeat-y 100% 0; } The list -style property combines list-style-types, list-style-postition, and list-style-image Read More...

CSS, How to use Shorthand Margins and Padding.

August 2nd, 2009

Margins create space between the edge of an element and the edge of any adjacent elements. Padding creates the space between the edge of the element and its content. The margin and padding shorthand properties also can be used to make CSS code more concise. The margin property can combine margine-top, margin-right, margin-bottom, and margin-left Read More...

CSS, How to use Shorthand Borders.

August 1st, 2009

Border properties can be converted to the shorthand border property. The <h1> element can be styled with border-width, border-style. and border-color or with a single border property. Longhand Properties h1, h2 { text-align: center; color: navy; } h1 { border-width: 1px; border-style: solid; border-color: gray; } h2{ font: italic small-caps bold 100%/120% arial, helvetica, sans-serif; } p { color: maroon; font: 80% arial, helvetica, sans-serif; } Shorthand Border h1, h2 { text-align: center; color: navy; } h1 { border: 1px  solid gray; } h2{ font: italic small-caps bold 100%/120% arial, helvetica, sans-serif; } p { color: maroon; font: 80% arial, helvetica, sans-serif; }

CSS, How to use Shorthand Properties!

August 1st, 2009

Shorthand Properties allow the values of several properties to be specified within a single property. Shorthand properties are easier to write and maintain. They also make CSS file smaller and faster to load. For example, the h2 element can be styled with font-style, font variant, font-weight, font-size, line-height, and font-family or with a single font property Read More...

CSS, How to add Comments to your CSS!

July 31st, 2009

Adding CSS Comments - CSS Comments can be added to CSS to explain your code. Like HTML Comments, CSS Comments will be ignored by the browser. A CSS Comment begines with /* and ends with */. Comments can appear before or within rule sets as well as across multiple lines. They also can be used to comment out entire rules or individual declarations Read More...

CSS, How to Combine Selectors!

July 31st, 2009

When several selectors share the same declarations, they may be grouped together to prevent the need to write the same rule more then once. Each selector must be separated with a comma. HTML Code <h1> CSS Headings One</h1> <h2> CSS Heading Two</h2> <p> Some text about your css tutorial would go here</p> CSS Code h1 { text-align: center; color: navy; } h2 { font-style: italic; text-align: center; color: navy; } In the above code The h1 and h2 elements share two declaration, so parts of the two rule sets can be combined to be more efficient Read More...

CSS, How to use Multiple Declarations?

July 31st, 2009

More than one declaration can be used within a declaration block. Each declaration must be separated with a semicolon. In this CSS, How To Tutorial the h1 and h2 elements will be styled with a new declaration. {color: navy;} The h2 element will also be styled with {text-align: center;} which will align it in the center of the browser window Read More...

Why Use CSS, Cascading Style Sheets?

July 31st, 2009

Easy to maintain - The power of CSS is that a single CSS file can be used to control the appearance of multiple HTML documents. Changing the appearance of an entire site can be done by editing one CSS file rather than multiple HTML documents. Smaller file sizes - CSS allows authors to remove all presentation from HTML documents, including layout tables, spacer images, decorative images, fonts, colors, widths, heights, and background images Read More...