/    Sign up×
Community /Pin to ProfileBookmark

Background image, link and alt tag

Hello,
I have a script that is pulling images in via php as the background cell in a table. I was wondering, is there a way to use CSS to make that cell always a link? Also, can I make it so it always has an alt tag. The php randomly picks between about 10 pictures, and then I use
<tr height=”100″><td width=”670″ style=”background: url(‘../rotatingpix/top/rotate.php’) no-repeat center center;”>&nbsp;</td></tr>

to pull it in. Any suggestions on how to do something in the stylesheet that would pull that image in and make whichever it picks go to another page.

Thank you in advance,
Joe

to post a comment
CSS

1 Comments(s)

Copy linkTweet thisAlerts:
@toicontienFeb 01.2006 — You're talking about three completely separate entities: Server side scripting, HTML and CSS.

PHP can serve your browser HTML or CSS, and even images. How about something like this:
[code=html]
.randomBG {
background: transparent url(/randomImage.php) no-repeat scroll 0 0;
}
[/code]

Then in your HTML:
[code=html]
...
<tr class="randomBG">
...
</tr>
[/code]


Now as for the link? Hm. Not sure what you want there. If you want to link the image, use the <img> element instead, and surround it with the <a> element.
×

Success!

Help @joeblack spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...