Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Computer Forums > Programmers Lounge > Programming Discussions » CSS for Bringing Up Images Last
Closed Thread
Old 08-04-2008, 10:14 AM   #1 (permalink)
 
Newb Techie

Join Date: Jul 2008

Posts: 30

Rex100 is on a distinguished road

Default CSS for Bringing Up Images Last

I was reading, "Use CSS Images instead of IMG tag: An easy way to speed up the rendering of an image is to simply call as a background of a div tag.", and elsewhere that if you use CSS for images the images will come up last (after your text), which is what I want.

But I don't want to load up my css page with a long list of images (40), becuase the CSS page is loaded into the visitor's browser, and so will slow the length of time it takes to bring up my site. I really don't want to use sprites. Isn't there a way where I can load the images into a PHP includes file and refer to the includes file in the CSS, but what code would I use in the main coding (HTML) from page to page to to bring up the different images for different pages?

Thanks for the help,

Rex
Rex100 is offline  
Old 08-05-2008, 05:29 PM   #2 (permalink)
CrazeD's Avatar
 
Wizard Techie

Join Date: Feb 2006

Location: Maine

Posts: 3,683

CrazeD will become famous soon enough

Send a message via AIM to CrazeD Send a message via MSN to CrazeD
Default Re: CSS for Bringing Up Images Last

For static images, such as those used with template files, use CSS. For dynamic images, such as those that change from page to page, use HTML.

If you really want to create a CSS file for each page, which is rather stupid, you can do it pretty easily with PHP. Just make a folder called CSS. Then for each page, make a CSS file. Like, home.css, contact.css...etc. Then dynamically call the CSS file with PHP depending on the page. For simplicities sake, I'll just show you a snippet of code that uses GET for the page.

PHP Code:
<?php

$page 
$_GET['page'];

echo 
'<link rel="stylesheet" type="text/css" href="css/'.$page.'.css" />';

?>

__________________

Need website help? PM me!
CrazeD is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
NASA Images Osiris Web Graphics, Design, Digital Images 0 07-27-2008 01:08 PM
Is there a moron's guide to making cd/dvd images? 706 Windows Operating Systems and Software 4 07-21-2008 04:34 AM
Flashgot - Using complex patterns to get images? akasixcon Programming Discussions 0 03-19-2008 12:42 AM
Images Leaked of the AMD Radeon HD 3450, HD 3470 and HD 3650 vernong1992 Building, Buying, Upgrading for General PCs 2 12-23-2007 05:57 PM
Vista displays darker images? joowan Windows Operating Systems and Software 10 07-08-2007 03:27 PM