CSS font stacks, media style sheets & web standards

Your banner ad here

WestNIC provides reliable web hosting services

25% off cpanel web hosting and reseller hosting deals. Promo: codestyle25off

Site navigation below

This FAQ is part of the Code Style Help and FAQ section. Join our premium content service for full access all FAQs, or choose the single FAQ by email option for premium answers.

Code Style questions

Q: Can I subscribe to this site?

A: There is no subscription service for the Code Style site as a whole. Each of the main articles has an email notification option at the end of the page. Whenever the article is updated, an email notification is sent to subscribers. There are also RSS news feeds for each of the FAQ sections.

Our premium content package is a paid subscription service that provides access to complete answers for all FAQ questions, The subscription provides a password log in to the questions marked with the premium content button.

Actions: Follow-up, clarify or correct this answer. Submit a new question.

Q: I can't get your code to work!

A: The Code Style Web site is not intended for absolute beginners and assumes readers have some grounding in the relevant technologies. Detailed help debugging the working examples on this site is not possible, there are so many things which could be wrong with an adapted version. However the following pointers should help you check the basics.

Is the external file reference correct?

The Code Style site uses relative URL paths with a leading forward slash, /; this means the URL is relative to the root level of the domain, not the current directory. If you are adapting Code Style examples on a local file system, you will need to change these file references accordingly.

The following examples use stylesheet references, but the same conditions apply to all external files including scripts and images.

./Style.css
Refers to the file Style.css in same directory as the HTML source, the "current" directory.
styles/Style.css
Refers to the file Style.css in a subdirectory of the current directory called styles.
../styles/Style.css
Refers to the file Style.css in a directory called styles at the same hierarchical level as the current directory, i.e. in parallel to it.

Has the script file loaded?

To check if an external script file has loaded, add the following code to the top of the file and reload the HTML:

// Debugging
alert('Script loaded.');
          

This should raise a visible dialogue box if the script loads (you may need to clear your browser's cache to force a reload). Once you're sure the script has loaded, put other temporary alerts into the script to find out which parts execute and which fail.

To check if an external stylesheet file has loaded, add an extreme style rule to make it obvious and reload the HTML:

BODY{
  color:            black;
  background:       red;
}
      

Remember, external stylesheets should not include any <style> markup or <!-- HTML "hiding" comments --> for the style rules.

If the CSS still isn't working, use a CSS syntax checker and markup validator to make sure you haven't corrupted the code in some way. Avoid the use of graphical HTML or CSS editors which may re-format or add to your code in unexpected ways. Microsoft Front Page is a frequent offender in this regard.

Actions: Follow-up, clarify or correct this answer. Submit a new question.

Q: You can use PHP to exclude URLs from form submissions you know!

A: Yes, the instruction "Do NOT put any URLs here" is part of a comment spam avoidance strategy used on the Code Style site, which is quite effective. Spammers tend not to take account of this simple instruction, especially if the form is submitted remotely or automatically, so any submission that includes an URL in the message field is discarded. Use the reference URL field to include a web address in your submissions.

Actions: Follow-up, clarify or correct this answer. Submit a new question.

Finding content

Q: I couldn't find the site stylesheets, where are they?

A: All the stylesheets for the Code Style Web site are held in a separate directory from the XHTML documents. See Code Style CSS for full details.

Actions: Follow-up, clarify or correct this answer. Submit a new question.

Site styling

Q: This site seems pretty plain, what's the problem?

A: The Code Style site uses Cascading Style Sheets (CSS) exclusively to suggest presentation styles for these Web pages, see Code Style CSS. If your browser doesn't support CSS, has CSS switched off, or has only rudimentary support for CSS, you will only experience these pages with whatever presentation settings your browser has configured.

The Code Style Web site is designed to work perfectly well without stylesheets, but see Style warning to find out how to enable CSS support in your browser or download a browser which supports CSS.

Actions: Follow-up, clarify or correct this answer. Submit a new question.

Q: Shouldn't you use a script to point users to browser friendly pages?

A: Hopefully you will see that all the pages on the Code Style site are browser friendly. The CSS style warning link is only to notify readers they are not be seeing the site in all its glory!

This site should work acceptably without CSS enabled, but readers' usability feedback is always welcome.

Actions: Follow-up, clarify or correct this answer. Submit a new question.

Q: Why don't you have printer friendly pages?

A: There is a CSS print media style sheet, CSPrint.css, attached to all standard pages so they all print the main article content cleanly without navigational and interactive elements. See the Media dependent style sheet FAQ for more details.

Actions: Follow-up, clarify or correct this answer. Submit a new question.

Q: Which heading font is used on the Code Style site?

A: Code Style headings are set in a Palatino font stack with a serif generic font family, which means your browser should choose a font in that style if none of the named fonts are matched on your computer.

Actions: Follow-up, clarify or correct this answer. Submit a new question.

Add this page to your chosen social bookmarking service

Style warning - please read

Home · CSS · Java · Javascript · HTML · Help · Log