using different bgcolor with include
Hi,
I have a page which includes a few other pages
(<%@include=" "%>) but these pages have different backgroundcolors. With the include the bgcolor of the main page is dominant. How can you change this. I tried several things including things with stylesheets. I need a way to override the bgcolor of the main page.
Hope someone has an idea.
Thanks,
Maarten
When you say the included page has a different background colour, are you implying that it has an HTML <body> tag with the bgcolor attribute set differently? If so, then do you realise that you might be including an HTML page inside an HTML page?
The page source might look like this (view source from browser):
<html>
<head>
<title>...</title>
</head>
</title>
</head>
<body bgcolor='red'>
...
<html>
<head>
<title>...</title>
</head>
</title>
</head>
<body bgcolor='blue'>
...
</body>
</html>
...
</body>
</html>
If this is the case, then you don't actually have a valid HTML page; The browser will pobably ignore the second body tag (as well as any repeated head etc.) as everything is interpreted as a single HTML page, and only one body tag is allowed. If you don't have multiple head sections but more than one body section, its still not valid.
If you want different incuded sections of the page to have different background colours, wrap each include inside a table and give the table a background colour. If you are including sections that are comlete pages in their own right, then you shouldn't be - you can't be sure how they will be interpreted by different or future browsers. Just include the bits that are common to different pages, not the whole page.
If this isn't the scenario you've got, can you explain in more detail.
you can't have body for Included JSP files.
declare different <DIV> 's with different colors in main page ,and put the INCLUDE tag in the DIV.
<DIV style="position:absolute;top:100px;left:100px;.....">
<@include....>
</div>
remember to declare the style (positions) to those DIV's.
ynroy at 2007-6-29 9:19:50 >
