There are two kinds of css failure:
1. The css has errors in it that prevent correct rendering.
2. The css renders, but not the way the page creator wants.
1. Look for the following css errors if the css does not render:
- Look for typogoofical errors first.
- On Firefox, use the error console. It will tell you the line containing any syntax error.
- Make sure you spelled the classes and ids the same in all references.
- Make sure you didn't use the same name for two different classes or ids.
- Make sure you didn't use an id twice.
- Make sure that there are no units of measure on 0 values. Some browsers do not allow them.
- No special characters in classes and ids.
- Beware of deprecated and browser-specific styles and properties.
2. Look for the following if the css does not render the way desired:
- Remember that the surrounding styles (margin, border, padding) are rendered OUTSIDE any box object. Leave enough space for them to fit.
- If something intended for the same row renders below the row, it probably does not fit in the remaining space.
- Don't put size styles (width, height), and surrounding styles in the same style or tag. This is the key to inter-browser compatibility.
- Is the div shrinking, instead of containing the contents? Use the style: display: table-cell;
- Note that some displays do not differentiate colors that are close to each other.
- If you expect compatibility across different screen resolutions, use % and em to set sizes. The styles cm, in, and pt set a size based on an average display, but don't always work on the display you have. The px style makes the object change size with the screen resolution, covering different parts of the browser pane on different computers.
- Don't expect to exactly fill the browser pane vertically. It can't be done in a way that works on all computers, resolutions, aspect ratios, browsers, and restored-down window dimensions.
- Check to see if a style you do not want is inherited from a containing object. If it is, you will have to make another style for the inheriting object that cancels the inherited style.
- Always specify text-align and vertical align for all table cells. IE and FF have different defaults for these.
- Don't use absolute or fixed location. They do different things on different browsers.
- Don't use negative values for sizes. They do different things on different browsers.
- Remember that a repeated image may be incomplete at the edge of the repetition.
- Don't expect everything to look exactly the same on different browsers.
- Don't expect z-axis to always work. Some objects expect to always be on top.
MidiMagic
Nearly a Senior Poster
3,319 posts since Jan 2007
Reputation Points: 730
Solved Threads: 182
MidiMagic
Nearly a Senior Poster
3,319 posts since Jan 2007
Reputation Points: 730
Solved Threads: 182