It appears you have not yet registered with DEVPPL. To register please click here... (it's fast, easy and free!)

Forum

Log In Sponsors
Board index Programming JavaScript Forum

Browser version based CSS

Browser version based CSS

Postby sorenchr on Thu Aug 14, 2008 8:19 pm

Hi

I was wondering if i'm able to detect a visitors browser version, and then base my webcontent on that. Im using .png files with PNG-24 Alpha Transparency, which works fine in Firefox, and IE (version 7 or over). However, when users visit my site with IE6, the .png files looks ugly and i want to utilize .gif pictures instead.

I use the .png files as table backgrounds for my html page, which are defined in the css style tags. So is it possible to do something like this:

Code: Select all

// FOR IE6

/* content definitions */

.contentBoxTop
{
   background:url('../border_top.gif') no-repeat;
}
.contentBoxMain
{
   background:url('../border_middle.gif') repeat-y;
   padding-right: 6px;
}
.contentBoxBottom
{
   background:url('../border_bottom.gif') no-repeat;
}

// FOR IE7 AND UP, FIREFOX, OPERA

/* content definitions */

.contentBoxTop
{
   background:url('../border_top.png') no-repeat;
}
.contentBoxMain
{
   background:url('../border_middle.png') repeat-y;
   padding-right: 6px;
}
.contentBoxBottom
{
   background:url('../border_bottom.png') no-repeat;
}


Thank you for your help and answers
sorenchr
 
Posts: 0
Joined: Thu Aug 14, 2008 8:06 pm

Postby rangana on Fri Aug 15, 2008 2:56 am

Have this CSS:
Code: Select all
<!--[if lt IE 7]>
/* content definitions */

.contentBoxTop
{
   background:url('../border_top.gif') no-repeat;
}
.contentBoxMain
{
   background:url('../border_middle.gif') repeat-y;
   padding-right: 6px;
}
.contentBoxBottom
{
   background:url('../border_bottom.gif') no-repeat;
}
</style>
<![endif]-->


Hope that helps.
User avatar
rangana
500+ Club
 
Posts: 935
Joined: Wed Feb 27, 2008 5:14 am
Location: Cebu City Philippines


Who is online

Users browsing this forum: No registered users and 4 guests