| Author |
Weird Behaviour of CSS in JSP
|
Rajesh Khan
Ranch Hand
Joined: Oct 16, 2011
Posts: 230
|
|
The behavior of the above code regarding mixing of CSS with generated HTML is confusing me. According to my understanding no matter what condition is accepted (ConditionA or ConditionB) the generated HTML in both cases should be inside the class "msg" however I am getting different results. ConditionB only gets enclosed in the class msg whereas condition A in which a table is generated is placed below the class "msg" (i.e the class is closed and then the table starts) Could anyone tell me whats going on?
|
 |
Pongsakorn Semsuwan
Ranch Hand
Joined: May 15, 2011
Posts: 34
|
|
I think there might be some mistakes in your code.
I suggest you to paste your code here so we can help reviewing it.
|
A web application developer wannabe from Thailand
My StartUp : http://www.dreamlog.co
Blog : http://pongsakornsemsuwan.wordpress.com
|
 |
Rajesh Khan
Ranch Hand
Joined: Oct 16, 2011
Posts: 230
|
|
|
The problem is resolved if i use <div class = "msg"> ... </div> instead of <p> . Hope someone could tell me why <p> doesnt work
|
 |
Pongsakorn Semsuwan
Ranch Hand
Joined: May 15, 2011
Posts: 34
|
|
I do a little research and it seems like a paragraph cannot contain any other block-level elements. Perhaps that's why <p> tag is closed before <table> tag.
But I wonder what mechanism make it automatically closed ?
|
 |
kiran badi
Greenhorn
Joined: Oct 26, 2009
Posts: 26
|
|
|
I think it all depends on the doc type declaration what you give for HTML.I often validate my html with w3c validator to ensure that html is correct.This atleast saves me some time fixing cross browser issue and have code base which meets standards.Cultivate this habbit, its good.
|
 |
 |
|
|
subject: Weird Behaviour of CSS in JSP
|
|
|