![]() |
embedding CSS in PHP, example, please look
print "<IMG STYLE="position:absolute; TOP:35px; LEFT:170px; WIDTH:50px; HEIGHT:50px" SRC="hair$hair.gif">";
Whats wrong with that line? thanks. |
Quote:
|
the line:
print "<img src = hair$hair.gif>"; works. but when I try to add CSS it goes to shit. |
A. You do not fucking do that, all styles go into the CSS file, no hardcoding
print "<IMG class='imgstyle' SRC='hair$hair.gif'>"; |
try this:
echo "<IMG STYLE=\"position:absolute; TOP:35px; LEFT:170px; WIDTH:50px; HEIGHT:50px\" SRC=\"hair".$hair.".gif\">"; |
Quote:
If you could explain I would cream my pants, but if you cant I am still insanely grateful. Thanks again. |
you can't use the same type of quotes (in this case double quotes) inside the string you're trying to print without escaping them.
basically your print statement starts at the first double quote and ends at the next one, which was right after STYLE=, and that caused the error. |
Quote:
or just escape the -> " characters |
Quote:
The ultimate correct way is like this: echo '<img src="whatever.gif" class="super_pic" style="border: 1px solid red;" />'; Print is not required here, nor is escaping quotes. |
| All times are GMT -7. The time now is 05:04 PM. |
Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2026, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123