background preloader

Basic Techniques

Facebook Twitter

Basic CSS Rules. Part 2/2, which lists the major CSS rules and how to apply them to your pages.Last updated: May 17, 2007 This page lists and explains some of the CSS rules you can use to enhance your web pages.

Basic CSS Rules

Most CSS rules have two ways to implement certain attributes. Using fonts as an example, you can define the font size using the specific 'font-size' property. However, you can also define it in the general 'font' property, along with all the other font properties. I will list the specific ones first, then give an example of using the general form. Font & text properties Here are several font properties you can use, and the values each one can take: Basic Cross-browser Gradient Syntax. One thing that is quite nice is that we now have the ability to create gradients in our pages just from CSS code, and without the use of any images.

Basic Cross-browser Gradient Syntax

Syntax options and web browser support The good news is that there is web browser support for CSS gradients in Firefox, Safari, Google Chrome and Internet Explorer (Opera will most likely add it soon too). The bad news is that, for a couple of reasons, the implementation in each web browser is different from the other. In IE’s case, it’s because it’s based on their ancient approach that stems form IE 5.5. For WebKit-based web browsers (like Safari and Google Chrome), they were the first ones to suggest it, based on the approach for canvas, but this was later changed by the CSS WG, and the new syntax is now the one implemented in Firefox (and I guess this syntax will later make into WebKit-based web browsers as well). So, as of now, we have have CSS gradients support for: Firefox 3.6Safari 4Google ChromeIntenet Explorer 5.5 Examples 01. 02. 13. Hide page contents from printing. CSS generated content techniques - Opera Developer Community.

Introduction The content property was introduced in CSS 2.1 to add generated content to the :before and :after pseudo-elements.

CSS generated content techniques - Opera Developer Community

This is now supported on all major browsers — Firefox 1.5+, Safari 3.5+, IE 8+, Opera 9.2+, Chrome 0.2+). In addition, Opera 9.5+ supports the content property on all elements, not just the :before and :after pseudo-elements. In the CSS 3 Generated Content Working draft, the content property has had a lot more features added – for example, the ability to insert and move content around a document to create footnotes, endnotes, and section notes. But no browser has implemented the expanded functions of content yet. In this article, we will look at the basics of using generated content, and then break out into specific techniques you can employ it in.

A few caveats Before we dive into the subject, it's worth pointing out that generated content will only work in modern browsers with CSS enabledis not available via the DOM. CSS shorthand properties. One of the main advantages of using CSS is the large reduction in web page download time.

CSS shorthand properties

To style text, you used to have to use the <font> tag over and over again. You probably also laid out your site with tables, nested tables and spacer gifs. Now all that presentational information can be placed in one CSS document, with each command listed just once. But why stop there? By using CSS shorthand properties you can reduce the size of your CSS document even more. Font Use: font: 1em/1.5em bold italic serif ...instead of.

Define color of bullets. Vertical List Tutorial. Tutorial 4 - Horizontal lists - all steps combined There are many methods that can be used to making a horizontal list. The main ingredient is "display: inline", applied to the "LI" element. HTML CODE <div id="navcontainer"> <ul> <li><a href="#">Milk</a></li> <li><a href="#">Eggs</a></li> <li><a href="#">Cheese</a></li> <li><a href="#">Vegetables</a></li> <li><a href="#">Fruit</a></li> </ul> </div> Step 1 - Make a basic list Start with a basic unordered list. Step 2 - Remove the bullets To remove the HTML list bullets, set the "list-style-type" to "none".

Step 3 - Remove padding and margins Standard HTML lists have a certain amount of left-indentation. To remove this left-indentation consistently across all browsers, set both padding and margins to "0" for the "UL". Step 4 - Display inline To force the list into one line, apply "display: inline;" to the "LI". Step 5 - Removing text decoration At this point you may wish to remove the text underline.