开发者

jsp:include making the divs mis-aligned in ie7

开发者 https://www.devze.com 2023-03-23 13:39 出处:网络
I have a webpage in which I am using 2 jsp:include directives. Basically one is the header and other is the footer. The headers and footers are aligned correctly. But the central body of the main pa开

I have a webpage in which I am using 2 jsp:include directives. Basically one is the header and other is the footer. The headers and footers are aligned correctly. But the central body of the main pa开发者_运维技巧ge is aligned to the left side.

This is the code of the page.

page.jsp

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"   "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<%@page contentType="text/html" import="java.util.*" %>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link rel="stylesheet" href="images/style.css" type="text/css" />
<title>HireZilla</title>
</head>
<body>
    <jsp:include page="../top_and_left.jsp" flush="false"></jsp:include>
    <div id="contenttext" align="center">
        Hello World!!
    </div>
    <jsp:include page="../footer.jsp" flush="false"></jsp:include>
</body>
</html>

This is the code in the browser. I can see that there are lot of tags lying here and there because of the "jsp:include"s. But i dont know how to remove them.

The div tag with "Hello World" gets aligned in the left most corner of the page after the header and before footer elements. My header("top_and_left.jsp") as the name suggests has an 'L' shape with links in the left side of the page and a banner in the top. I want the div tag to come inside the L. I am able to do this in browsers ie8 and above but not in ie7.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html> 

<head> 
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
<link rel="stylesheet" href="../../css/style.css" type="text/css" /> 
<title>HireZilla</title> 
</head> 
<body> 
    <div id="page" align="center"> 
    <div id="toppage" align="center"> 
        <div id="date"> 
            <div class="smalltext" style="padding:13px;"><strong>Wed Jul 27 23:14:08 IST 2011</strong></div> 
        </div> 
        <div id="topbar"> 
            --Links in the top right corner--
        </div> 
    </div> 
    <div id="header" align="center"> 
        <div class="titletext" id="logo"> 
            <div class="logotext" style="margin:30px">Hire<span class="orangelogotext">Z</span>illa</div> 
        </div> 
        <div id="pagetitle"> 
            <div id="title" class="titletext" align="right" >Welcome to HireZilla!</div> 
        </div> 
    </div> 
    <div id="content" align="center"> 
        <div id="menu" align="right"> 
            <div id="linksmenu" align="center"> 
                --Left link panel menu--
            </div> 

        </div> 
    </div> 

    <div id="contenttext" align="center"> 
        Hello World!!
    </div> 


<div id="footer" class="smallgraytext" align="center" style="margin-left:225px" > 
        --Footer goes here--
</div> 


    </div> 
</body> 
</html>

This is the contenttext element in my css

#contenttext{
width:608px;
background-color:#F7F7F7; 
border-left:solid 1px #999999; border-right:solid 1px #999999; 
border-bottom:solid 1px #999999; border-top:dotted 1px #CCCCCC; 
min-height:360px;
}

I am not sure whether I have put the question in the right way. I would be happy to clarify.

I dont want to crowd this page more with the css also. If you can let me know which elements you want to see, I can paste their code here. Thanks in Advance


You are including a full html page within the body of another html page. This is causing all kinds of invalid html.

To fix this, strip all of the extra stuff out of footer.jsp and top_and_left.jsp. Remove the <html>, <head>, <body>, etc. The file should only include the html which you want injected into your body. This will likely clean up most of your issues.

0

精彩评论

暂无评论...
验证码 换一张
取 消