...

View Full Version : css background image error



surreal5335
07-18-2008, 09:55 PM
I have coded a background image in a table using css following a tutorial, but When I test it I get an error saying I need to add a ',' or ';' in the string somewhere

Here is what I have:



<table border="1" width="100%" style="background-image:url('http://i95.photobucket.com/albums/l136/surreal5335/RE%20site/Fotolia_2695889_XS.jpg');
background-repeat: no-repeat; background-attachment: fixed; background-position: right, bottom">


I appreciate the help

Millenia
07-18-2008, 09:58 PM
<table border="1" width="100&#37;" style="background-image:url('http://i95.photobucket.com/albums/l136/surreal5335/RE%20site/Fotolia_2695889_XS.jpg');
background-repeat: no-repeat; background-attachment: fixed; background-position: right, bottom;">Try that

If you didn't notice what I did, I added a semi colon here:


background-position: right, bottom;

Apostropartheid
07-18-2008, 10:02 PM
background-position doesn't take comma-separated values, and as far as I know a final semi-colon is implied. Try


background-position: right bottom;

Millenia
07-18-2008, 10:12 PM
Yeah, take the comma out of the code I gave you

surreal5335
07-18-2008, 10:15 PM
Thanks for the help, I have made those changes, but still I have the same problem.

Anything else you can think of?

on a side note: I am using php to echo the css, will this cause a problem with background images?

The reason I am php to echo it, is bc this is the only I was able to make the include function on it work

Apostropartheid
07-18-2008, 10:16 PM
um, link to page?

surreal5335
07-18-2008, 10:25 PM
sure:

mwebbuilder.x10hosting.com

Thanks for the help


sorry about that I realize now that I need to take out the troublesome code in order for you to see anything useful

Apostropartheid
07-18-2008, 10:40 PM
So...where would it be?
You'd probably be better off leaving it in so we can fiddle with it.

surreal5335
07-18-2008, 10:47 PM
I left a comment on it including the bad code at the end of the <head> tag
Hope this helps
Thanks

macwiz
07-19-2008, 12:19 AM
echo' function

try changing it to this:


echo 'function'

surreal5335
07-19-2008, 01:23 AM
that part you are refering to is inside the comment brackets. The actual code thats causing the problem which is giving me an error to add a ',' or ';' in it is strictly css on the exact line below it. The line of that is to tell you where I am trying to plug it in (the first table tag)

Sorry for the confusion

My code now looks like all the tutorials I have found on the internet to processing background images, so im rather clueless as to why I and where I need to add a comma or semi-colon. Apparently somehwere in that string of css

Thanks for your help in this matter

bazz
07-19-2008, 03:06 AM
OK I could be way off here but, I am not familair with using css inside js tags.

And in the source code of your html page, there is no echo tag so it is hard to relate that comment with the actual script.

Should the css not be enclosed with this tag like this




<script type="text/css>

table {
background-image: url('http://i95.photobucket.com/albums/l136/surreal5335/RE&#37;20site/Fotolia_2695889_XS.jpg');
background-repeat: no-repeat;
background-attachment: fixed;
background-position: right bottom;
}


</script>


forgive me if I am wrong :)

bazz

macwiz
07-19-2008, 03:20 AM
It is your first post that got me to say that.

You said that the page returned an error during testing.

Browsers IGNORE HTML and CSS errors. However, if the PHP is wrong, it will be incorrectly parsed by the server, and the browser WILL return an error.

I ran your code snippet you gave us through Dreamweaver 3 times. It returned no errors. I also tried the page in my browser, locally too. Nothing.

Nightfire
07-19-2008, 03:21 AM
I don't understand how you're knowing you need to add a semi-colon or whatever? I just looked at the tagsoup code and it'll work.

BTW, html comments aren't ended with --!> They end as -->


<table border="1" width="100&#37;" style="background-image: url('http://i95.photobucket.com/albums/l136/surreal5335/RE%20site/Fotolia_2695889_XS.jpg'); background-repeat: no-repeat; background-attachment: fixed; background-position: right bottom;">

surreal5335
07-20-2008, 07:38 PM
interesting, so it sounds like this maybe a php problem if any at all? Ill turn off firebug and see if that solves my problem.

Thanks a lot for all your help

surreal5335
07-20-2008, 07:49 PM
well I turned off the firebug but im still getting a parse error.

This is the error I am getting:

Parse error: syntax error, unexpected T_STRING, expecting ',' or ';' in /home/surreal/public_html/index.php on line 51

Here is the page of code that I am trying to get to work from start to finish:



<?php
ini_set('display_errors','on');
error_reporting(E_ALL);
?>
<html>
<head>

<script language="javascript" type="text/javascript">


function rollOn(obj){
obj.src=obj.src.replace(/.png/,"blue.png");
}
function rollOff(obj){
obj.src=obj.src.replace(/blue.png/,".png");
}



var currentSpan = 1;
function showMe(n) {
document.getElementById("ex_"+currentSpan).style.display = "none";
document.getElementById("ex_"+n).style.display = "block";
currentSpan = n;
}

var currentDiv = 1;

function showcontent(n) {

// Hide the current side content that is being shown
document.getElementById("SC_"+currentDiv).style.display = "none";

// Show the new side content
document.getElementById("SC_"+n).style.display = "block";

// Set the current open side content
currentDiv = n;
}
/*this css code is to be entered into the first table tag just underneath the echo' function
style="background-image: url('http://i95.photobucket.com/albums/l136/surreal5335/RE%20site/Fotolia_2695889_XS.jpg'); background-repeat: no-repeat; background-attachment: fixed; background-position: right bottom;"*/

</script>




</head>
<?php
echo'
<table border="1" width="100%" style="background-image: url('http://i95.photobucket.com/albums/l136/surreal5335/RE%20site/Fotolia_2695889_XS.jpg'); background-repeat: no-repeat; background-attachment: fixed; background-position: right bottom;">
<tr>
<td>
<table width="100%" border="1">
<tr>
<td>
//header logo
</td>
</tr>
<tr>
<td>
//horizontal ad banner
</td>
</tr>
</table>';

require "renavbar.php";


require "rollcontent.php";

echo '
</td>
<td>
</td>
//vertical banner ad
</td>
</tr>
</table>
<table>
<tr>
<td>
//bottom navigation
<a href=" ">advertise</a>
<a href=" ">support</a>
<a href=" ">submit content</a>
<a href=" "></a>
<a href=" "></a>
</td>
</tr>
</table>';
?>


I took some html that has nothing to do with the problem to make it less cumbersome.

Thanks a lot for the help



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum