Jump to content

Too many <spans> inside a link?


MacLustre

Recommended Posts

HiThe xhtml validator is pointing to a problem within this line of code:<a href="gala2009_jones_smithssbakery.html#merchant"><span class="merchantcolor">Barley's Bakery</span><span class="fontblack marginat">:</span><a href="amdst2009_ajersch_barleysbakery.html#merchant"><span class="menublue font85">Mike Jones</span></a>The Validator's message (in part) is: "…unnescully_bscafe.html_m"><a href="amdst2009_dunnescully_bscafe.html#merchant">" (It's pointing to the closing bracket)"The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>")."I'm guessing that I could solve the problem by cut-pasting the <a> link around each <span> set. I want each to have its own colour and <span> seemed the safest way to do that.I'm poised and ready to manually cut-paste all the code on this menu so that each <span></span> group is alone inside a link. There'd be hardly a blip with the mouseover.But I'm asking for confirmation, to be sure that the three <span>s are what's causing the trouble, and not something else.Thanks

Link to comment
Share on other sites

Am I correct that this link: <a href="amdst2009_ajersch_barleysbakery.html#merchant">comes inside this one: <a href="gala2009_jones_smithssbakery.html#merchant"> ?That would be a problemAnd where the heck is this link: <a href="amdst2009_dunnescully_bscafe.html#merchant"> ?You should post more code, so we can see this stuff in greater context. A link would be better still.

Link to comment
Share on other sites

HiHere's a follow-up from the last message.I failed to take into consideration some code just ahead of this line: <a name="link"> I'd forgotten to write it: <a name="link" /> Once I fixed that typo, the error list collapsed to a short list of a few other dumb things. The Validator does a VERY good job, and this time I was having trouble meeting it half-way.I'm going to leave those <span>s inside the link, but I'm still interested in hearing from someone who's found an elegant flow to replace the clunker I've written.Cheers

Link to comment
Share on other sites

why don't you make special classes for your <a> tags that you can use instead of using an <a> tag and a span? Just make a merchant <a> and then a merchant name <a> with respective class applied to those <a> tags and ditch those spans?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...