• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Weird Behaviour of CSS in JSP

 
Ranch Hand
Posts: 230
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 34
Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ?
 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic