PDA

View Full Version : html parsing problem



raghu207
Aug 14th, 2007, 12:47 PM
Hi all..

I donno if i should post this here or on the JSP section, but here goes..

Here's my problem:
I have a certain HTML structure to which i have applied some CSS styles. However, when the page comes from the server, *sometimes* the structure which is supposed to be like this
<a><div><span> ( blah blah ) </span></div></a>

comes as
<a></a><div><span><a> ( blah blah )</a></span></div>

Can someone please explain how this is happening? Frankly, I'm going crazy trying to figure this thing out..

Thanks in advance!
raghu207

michael180
Aug 14th, 2007, 04:26 PM
Are you hand coding or using some type of code generating program?

abduraooft
Aug 14th, 2007, 04:51 PM
Normally, you can't use <div>(a block level element) inside an <a>(inline element.)

Jutlander
Aug 14th, 2007, 05:31 PM
Normally, you can't use <div>(a block level element) inside an <a>(inline element.)

Normally? Never. ;)

raghu207
Aug 16th, 2007, 09:48 AM
I am writing the code by hand..

<div> not allowed inside <a> ? Wow.. Maybe its just me but I havent heard of any such thing.. Is there some reference on the net where i can get some info on this or is this common knowledge?

And how can this cause the tags to appear in different order?

croatiankid
Aug 16th, 2007, 01:03 PM
Yes (http://homepages.tesco.net/~J.deBoynePollard/FGA/questions-with-yes-or-no-answers.html).

And to be a bit more helpful, this (http://www.w3.org/TR/html401/) is the best reference.

There are 2 types of elements in HTML, block and inline. Search the web about them. Note that even if you specify with CSS a different "display" setting, it doesn't change the element's block or inline type, just its appearance.

raghu207
Aug 27th, 2007, 04:39 PM
Sorry took so long to reply..
Yeah, that was the problem alright.. Seems block within inline has potential rendering problems..

Thanks everyone!
raghu207

Jutlander
Aug 27th, 2007, 06:04 PM
Seems block within inline has potential rendering problems..

Yes, because it is not allowed.