wood burning stoves 2.0*
The moose likes JSP and the fly likes Weird Behaviour of CSS in JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » JSP
Bookmark "Weird Behaviour of CSS in JSP" Watch "Weird Behaviour of CSS in JSP" New topic
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.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Weird Behaviour of CSS in JSP
 
Similar Threads
how to avoid show buttons
DIV Tag Loading Behavior is Erratic
JSTL how to use ELSE in JSP
JSTL - total count for loop within a loop
Choose table tag