Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > link a background-image / div

Reply
Thread Tools

link a background-image / div

 
 
Marco Lehmann
Guest
Posts: n/a
 
      11-04-2003
hi guys,

i have a div, in which a table and a text is located.
with css i defined a background-image laying under the div.
now i want to link the whole div with an a-tag.
w3c's validator says, that a construct like:

<a href="...">
<div id="...">
<table ...>
...
</table>
</div>
</a>

isn't valid because the div-tag seams to be misplaced
inside the a-tag.
i got this validation message:

document type does not allow element "DIV" here; missing one of
"APPLET", "OBJECT", "MAP", "IFRAME", "BUTTON" start-tag

what's the solution?
thanks in advance.

marco

 
Reply With Quote
 
 
 
 
Steve Pugh
Guest
Posts: n/a
 
      11-04-2003
Marco Lehmann <(E-Mail Removed)> wrote:

>i have a div, in which a table and a text is located.
>with css i defined a background-image laying under the div.


Okay, might be a bit over-complex but okay.

>now i want to link the whole div with an a-tag.


You can't do that.

>w3c's validator says, that a construct like:
>
><a href="...">
> <div id="...">
> <table ...>
> ...
> </table>
> </div>
></a>
>
>isn't valid because the div-tag seams to be misplaced
>inside the a-tag.


Yup.

Don't nest the <div> inside the <a>. Without knowing more about your
page (such as what data goes into the table and why you want an entire
table full of data to be a single link) it's hard to suggest an
alternative.

Steve



--
"My theories appal you, my heresies outrage you,
I never answer letters and you don't like my tie." - The Doctor

Steve Pugh <(E-Mail Removed)> <http://steve.pugh.net/>
 
Reply With Quote
 
 
 
 
Marco Lehmann
Guest
Posts: n/a
 
      11-04-2003
Hi Steve,

the only reason for linking a whole layer is,
that I probably have to change the text nested in the
table several times and I don't want to create a
graphic over and over again.

Here is the complete listing of the relevant part:

<a href="specials.html" class="tabLink">
<div id="specialTab">
<table width="100" cellspacing="0" cellpadding="0" border="0">
<tr>
<td width="100" height="40">
&nbsp;<br>
</td>
</tr>
<tr>
<td width="100" height="20">
Specials<br>
November 2003<br>
</td>
</tr>
</table>
</div>
</a>

Hopefully this will help a little bit.
Thanks in advance.

Marco

 
Reply With Quote
 
David Dorward
Guest
Posts: n/a
 
      11-04-2003
Marco Lehmann wrote:

> Here is the complete listing of the relevant part:


<snip>

Why is there a table there at all? I can't believe you possibly want to
describe a relationship between a non-breaking space with a line break and
what looks like a heading.


--
David Dorward http://dorward.me.uk/
 
Reply With Quote
 
Marco Lehmann
Guest
Posts: n/a
 
      11-04-2003
David Dorward wrote:

> Marco Lehmann wrote:
>
>
>>Here is the complete listing of the relevant part:

>
>
> <snip>
>
> Why is there a table there at all? I can't believe you possibly want to
> describe a relationship between a non-breaking space with a line break and
> what looks like a heading.
>
>


The div will be moved while the mouse cursor is over the
table. Therefore the div consists of a table, which
arranges the text and the space in the right way. The
distance between the top of the div and the text must be
exact.

Marco

 
Reply With Quote
 
Toby A Inkster
Guest
Posts: n/a
 
      11-04-2003
Marco Lehmann wrote:

> <a href="...">
> <div id="...">
> <table ...>
> ...
> </table>
> </div>
> </a>


Not allowed. You might technically be able to do this:

<a href="...">
<object>
<div id="...">
<table ...>
...
</table>
</div>
</object>
</a>

but this is likely to perform strangley in some browsers. Better to just
link the content of each table cell.

--
Toby A Inkster BSc (Hons) ARCS
Contact Me - http://www.goddamn.co.uk/tobyink/?id=132

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
<div ... /> and <div ...></div> K Viltersten ASP .Net 4 03-31-2009 07:33 PM
NS/FF don't change div offsetWidth when div innerHTML is added toand div becomes wider mscir Javascript 3 06-26-2005 04:04 PM
Q: Div A inside Div B is larger than Div B Dwayne Madsen Javascript 1 06-01-2005 03:02 PM
RE: Link Link Link =?Utf-8?B?REw=?= Windows 64bit 0 05-17-2005 12:15 PM
Re: Link Link Link DANGER WILL ROBINSON!!! Kevin Spencer ASP .Net 0 05-17-2005 10:41 AM



Advertisments