File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Weird Behaviour of CSS in JSP

 
Rajesh Khan
Ranch Hand
Posts: 230
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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
Posts: 34
Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think there might be some mistakes in your code.

I suggest you to paste your code here so we can help reviewing it.
 
Rajesh Khan
Ranch Hand
Posts: 230
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 34
Eclipse IDE Java
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 26
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic