Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating global CSS and header/footer for ALL our Web pages?

Status
Not open for further replies.

hperlman

Programmer
Jul 6, 2005
1
US
I work for a Federal agency (US Geological Survey), I've been working a lot with both CSS and XHTML standards (trying to convince the rest of the Web developers in USGS to use them!).

We just got a mandate from National Headquarters that all USGS web pages must use a certain CSS template and also a fixed header and footer file. When I looked at the CSS and header, etc, I noticed some possible problems, and now I'm on a committee to look into revising the CSS and header, footer.

First, they seem to use CSS for some tag attributes, but not all:
<table width="150" border="0" align="right">

(1) Would you suggest (if we are putting out a CSS template to be used by ALL USGS pages well into the future) that we should use CSS attributes for every possible instance in a tag? I mean, doesn't using CSS attributes only partially kind of defeat the purpose?

I know they will ask this: "If we use CSS for every possible tag attribute, will that cause problems with older browsers". I think the answer is "no"....?

A related(?) concern:
The header they sent out is written using plain HTML. Now, I now code in XHTML.

Well, here is their header file (below). Yes, I see nested TABLES (I assume this could done without tables, but ...). I see spacer gifs... I see they don't have TITLE attributes to help explain links and images.....and partial implementation using CSS... But, notice they use HTML coding instead of XHTML. Now, if I use a DTD for XHTML won't this header cause problems with my code, since my code will not verify for XHTML?

My question: Do we have to offer multiple header files? One in XHTML and another in HTML? Or, if we build a single header (and footer) in XHTML, would that work fine for everyone, even if they use use a DTD of HTML Transitional?

As a Gov't agency putting out Web pages, I just feel we ought to abide by standards and I fear the people who developed these files did not.. But, now that I'm the "complainer" and on the committee, they will expect me to be an expert in these matters - so I wanted to be able to offer correct advise.

Thanks a lot
Howard Perlman
US Geological Survey



--------------------------------------------------------------------------------------------------
<!-- BEGIN Header Template -->
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr> <td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="178" align="left"><a href=" src="header.jpg" alt="Link to USGS home page." width="178" height="72" border="0"></a></td>
<td width="100%" class="banner">
<table width="150" border="0" align="right" cellpadding="0" cellspacing="0" class="ccsa">
<tr>
<td><img src="spacer.gif" width="1" height="72" alt=""></td>
<td><a href=" class="ccsa">USGS Home</a><br>
<a href="index.html" class="ccsa">Contact USGS</a>
</tr>
</table>
</td></tr></table>
<img src="spacer.gif" width="1" height="1" alt=""></td>
</tr>
<tr><td class="siteTitle">Enter Site title </td></tr>
</table>
<!-- END USGS Header Template -->
 
If we use CSS for every possible tag attribute, will that cause problems with older browsers". I think the answer is "no"....?

It will if the older browsers do not support CSS. They have to define their target browser requirements, and not worry about browsers outside of that. Personally, I would no longer build for any v4 browser, looking to make IE6, and NN6 a minimum (or IE5.5 minimum, if you cannot convince them to run with IE6). Also Firefox 1, and Opera 7 are pretty good for standards compliancy as well.

Hope this helps,
Dan


[tt]Dan's Page [blue]@[/blue] Code Couch
[/tt]
 
Would you suggest ... that we should use CSS attributes for every possible instance in a tag?
Yes I would, for bandwidth-saving reasons if nothing else. The only CSS-ish attributes I leave in the markup are [tt]cellspacing[/tt] (cos the CSS alternative doesn't work in IE) and [tt]height[/tt] and [tt]width[tt] in most images - since giving each image an id and putting the size into the stylesheet is more trouble than it's worth.

Will it cause problems with older browsers? Possibly - but only very old browsers, and they'll still be able to read the site content, just less prettily.

Do we have to offer multiple header files? One in XHTML and another in HTML?
Possibly, though I think the dodge of putting a space before the trailing slash in those tags that need one - e.g. [tt]<br />[/tt] will validate as HTML as well as XHTML. If you stick to lower case, quote all attributes and keep your markup well-formed you can probably get away with one version. In any case, maybe you should be thinking about insisting upon validating to a particular doctype as part of your standards.

If you aren't doing so already, consider using SSI to include the standard bits into each page - makes it easier to change them in the future.

-- Chris Hunt
Webmaster & Tragedian
Extra Connections Ltd
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top