...

View Full Version : why .GIF image works well for background but not .JPEG



Ramy
02-11-2005, 06:25 AM
Hi,

Could somebody help and explain why?
I just write a simple html file to test the background with .GIF image and it works fine but it doesn't work for .JPEG image. I have Window XP professional.

Thanks for your help and reply.

Ramy.

_Aerospace_Eng_
02-11-2005, 06:31 AM
what does your coding look like? file names are case sensitive so if you image is saved as .JPG and your code is to a .jpg it wont work, same with gifs and any other image files, can u post your code plz? and possibly the images?

Ramy
02-11-2005, 06:50 AM
Hi,

Thank you for your help, the code is below

--------------------------------------------------------
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
"http://www.w3.org/TR/html4/strict.dtd">
<html><head><title>My main Page</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">

<style type="text/css">
.table {
text-color: #708090;
text-align: center;
position: absolute;
height: 4em;
width: 22em;
left: 50%;
top: 50%;
margin-left: -(width/2)em;
margin-top: -(height/2)em;
z-index: 100;
background: 747.GIF;
foreground-color: #708090;
background-color: #ddddee;
border-top: 1px solid #333366;
border-left: 1px solid #333366;
border-right: 3px solid #333366;
border-bottom: 3px solid #333366;
}
body {
font-family: sans-serif;font-color: red;
}
</style>
</head>

<body background="748.JPEG">
<h2> Hello World! </h2>
<TABLE BORDER CELLPADDING="8" CELLSPACING="4" COLS="3"
background="747.gif">
<TR>
<TD>
<IMG SRC="mainPage.jpeg" width=200 height=100 ALT="orange.JPEG"
USEMAP="#mainmap">
</TD>
<TD>
<IMG SRC="747.GIF" width=200 height=100 ALT="heart.jpeg"
USEMAP="#mainmap">
</TD>
</TR>
</TABLE>
</body></html>
---------------------------------------------------------
if I change

<body background="748.JPEG"> to <body background="747.GIF"> it works fine
but it doesn't work as <body background="748.JPEG">.

Once again thank you very much.

Ramy.

_Aerospace_Eng_
02-11-2005, 07:02 AM
what is the jpeg saved as? the exact file name? is it .JPG or .JPEG? and your coding is not HTML Strict well at least not according to the validator http://validator.w3.org/

Ramy
02-11-2005, 07:06 AM
Hi,

yes, it is saved as 748.JPEG.
I dont know how to attach the image to this site or else you could of test it out yourself and see the problem.
Once again, Thank you very much.

Ramy.

_Aerospace_Eng_
02-11-2005, 07:07 AM
you would click manage attachments under the submit button, but lets try this, rename the file to 748.jpg and and adjust it to your background also

Ramy
02-11-2005, 07:27 AM
Hi,

I tried to rename it to 748.jpg by right click on the image but i am so sure if i am allow to do that. anyway it doesn't seem to work. I will attached for you to try, according to http://validator.w3.org/, i might have some issue with my server. Could you please try on your to see if it work.
Once again, thank you very much.

Ramy
02-11-2005, 07:29 AM
hi,

here is the other 747.GIF image that work.
sorry, .GIF image is not valid for upload.
Thanx.

_Aerospace_Eng_
02-11-2005, 07:35 AM
it is valid but its the file extension, its uppercase, why can't you change the file name it doesn't make a difference as long as it works right? anyways, i tried what u did with the 748.JPEG as a background and it works fine

Ramy
02-11-2005, 07:52 AM
Hi,

If I can't resolve this problem then i have to choose a different image as background but I spend too much time on creating the .JPEG image. anyway,
Could you please help me with a another problem?

How can I apply the style/css as in my code to the table? that is my html file consist of a table right, so how can I apply the following code:

--------------------------
<style type="text/css">
.table{
text-color: #708090;
text-align: center;
position: absolute;
height: 4em;
width: 22em;
left: 50%;
top: 50%;
margin-left: -(width/2)em;
margin-top: -(height/2)em;
z-index: 100;
foreground-color: #708090;
background-color: #ddddee;
border-top: 1px solid #333366;
border-left: 1px solid #333366;
border-right: 3px solid #333366;
border-bottom: 3px solid #333366;
}
body {
font-family: sans-serif;font-color: red;
}
</style>
---------------------------
to the table, is it by inserting ".style.display = ' ' '' in
<TABLE BORDER CELLPADDING="8" CELLSPACING="4" COLS="3"
style.display = " ">

I tried but it doesn't work.
Once again, thanks a lot.

Ramy.

_Aerospace_Eng_
02-11-2005, 07:56 AM
<TABLE BORDER CELLPADDING="8" CELLSPACING="4" COLS="3" class="table">
i am not really sure what you are trying to do with

margin-left: -(width/2)em;
margin-top: -(height/2)em;
i've never seen that before, im not even sure if it event works, u can't put javascript which is what it looks like into css, for your body css try using this

body {
font-family: sans-serif;
color: red;
background-image:url(748.JPEG);
}

Ramy
02-11-2005, 08:04 AM
Hi,

Thanks for all the helps.
I will try that ASAP.

Ramy.

pb&j
02-11-2005, 03:40 PM
the image you uploaded to this forum is named "748.jpg" works ok for me.
you should be able to upload that to your own space and change the BODY tag to this...
<body background="748.jpg">

looking at your css part, i noticed this part...
margin-left: -(width/2)em;
margin-top: -(width/2)em;
the values dont look like any ive ever seen. is it valid?

same with these ones...
foreground-color: #708090;
background-color: #ddddee;
also ones i have never seen before. are they valid?

in your css is this part, this one...
text-color: #708090;
should be changed to this...
color: #708090;

also in your css is this...
background: 747.GIF;
it should be changed to this...
background-image: url(747.GIF);

if the image still does not work for your background, perhaps provide a link to your webpage as something else may be in error.

_Aerospace_Eng_
02-11-2005, 04:28 PM
<TABLE BORDER CELLPADDING="8" CELLSPACING="4" COLS="3" class="table">
i am not really sure what you are trying to do with

margin-left: -(width/2)em;
margin-top: -(height/2)em;
i've never seen that before, im not even sure if it event works, u can't put javascript which is what it looks like into css, for your body css try using this

body {
font-family: sans-serif;
color: red;
background-image:url(748.JPEG);
}
umm is that not what i just said?

pb&j
02-11-2005, 06:21 PM
umm is that not what i just said?
yeah, sorry. my fault for skimming and only half reading stuff. :rolleyes:



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum