Previous Message
Next Message

Pure <img> tags or Pure CSS

Sent by Marshall Lane on 7 January 2004 06:06


Gerard Samuel wrote:
> Whats your preference?
> "Generally", do you use <img> tags for images or use CSS to define them?
> Reason why Im asking is that Im trying to use images (that are primarily used 
> for links) that are defined in CSS, so that the images can change whenever 
> the CSS (Im using CSS for themes) changes.

Hi Gerard,

I use real images on my site, but I switch them along with the CSS by 
using PHP session variables to change the path to both images and css.

A link to an image will look like this:
<a href="somepage.php"><img src="<?php echo 
$_SESSION['theme']?>/images/adlogo.jpg" />

A link to a style sheet looks similar:
<style type="text/css">@import "<?php echo 
$_SESSION['theme']?>/css/default.css";</style>

The 'theme' setting is supplied by the user via a form. All of the 
images and styles for the various themes are named exactly the same,
with the exception of their containing folder, which is named after the
color of the theme. Thus, when a theme is selected, I am ONLY changing 
the name of the containing folder for images and css.

You can see how it works, and probably help me test it out as well. The 
basic site is up now, though most of the themes are not finished, they 
still need a lot of formatting changes and browser testing has not 
started yet. Just a concept really, but if you like it I will give you 
more details about how it works. See http://allegrodev.com for an 
example. Good luck with your site.

Marshall

______________________________________________________________________
css-discuss [EMAIL-REMOVED]]
http://www.css-discuss.org/mailman/listinfo/css-d
Supported by evolt.org -- http://www.evolt.org/help_support_evolt/
Previous Message
Next Message

Message thread: