Re: import text using CSS?

by "Jens Brueckmann" <lists(at)j-a-b.net>

 Date:  Thu, 10 Jun 2004 20:36:28 +0200
 To:  denise(at)amun-ra.demon.co.uk,
"hwg-techniques(at)hwg.org" <hwg-techniques(at)hwg.org>
 References:  localhost
  todo: View Thread, Original
Hi Denise,

> Someone has asked me if I can use CSS to import the contents of the menu  
> into the
> box without having to type out each item on the menu.

Principally it is possible to generate content in web pages by using the  
CSS "content" property[1].

However, this property is a double-edged sword and practice of using it  
for setting _real_ content should be strongly discouraged.

  - First of all, the most common browser, Internet Explorer, does not  
support this property.

  - Secondly, when a user chooses to switch off stylesheets in her browser,  
she is left out standing in the rain. The same applies if, for any reason,  
your stylesheet is not loaded or the user wants to read your pages offline  
but forgets to download associated files like your CSS.

  - Last not least this generated content is not part of the actual web  
page. Search engines will not be able to find it (and I am not sure if  
screen readers do).

> If that menu ever has to change, then every page for the website will  
> also have to be
> changed.  So is there a way of having the menu contents in the CSS so  
> its only
> changed the once?

The answer to your problem does not lie with CSS but with server-sided  
scripting. There exist a variety of methods, Server Side Includes  
(SSI)[2], Hypertext Preprocessor (PHP)[3], Active Server Pages (ASP)[4],  
Java Server Pages (JSP)[5], etc.
You should check with your hosting provider to find out which of these you  
can apply.


Best regards,

jens


[1] http://www.w3.org/TR/CSS21/generate.html#propdef-content
[2] http://httpd.apache.org/docs/howto/ssi.html
[3] http://www.php.net/
[4] http://msdn.microsoft.com/asp/
[5] http://java.sun.com/products/jsp/

-- 
Jens Brueckmann
http://www.j-a-b.net/

HWG hwg-techniques mailing list archives, maintained by Webmasters @ IWA