jsp:include 使 div 在 ie7 中未对齐

发布于 2024-11-26 09:54:26 字数 3191 浏览 2 评论 0原文

我有一个网页,其中使用 2 个 jsp:include 指令。基本上,一个是页眉,另一个是页脚。页眉和页脚正确对齐。但主页的中央主体与左侧对齐。

这是页面的代码。

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>

这是浏览器中的代码。我可以看到由于“jsp:include”,到处都有很多标签。但我不知道如何删除它们。

带有“Hello World”的 div 标签在页眉元素之后和页脚元素之前在页面的最左上角对齐。顾名思义,我的标题(“top_and_left.jsp”)具有“L”形状,页面左侧有链接,顶部有一个横幅。我希望 div 标签位于 L 内。我可以在 ie8 及更高版本的浏览器中执行此操作,但不能在 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>

这是我的 css 中的 contenttext 元素,

#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;
}

我不确定我是否以正确的方式提出了问题。我很乐意澄清。

我也不想用 css 来挤满这个页面。如果您可以让我知道您想查看哪些元素,我可以将其代码粘贴到此处。 提前致谢

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 page 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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

提笔落墨 2024-12-03 09:54:26

您正在将一个完整的 html 页面包含在另一个 html 页面的正文中。这导致了各种无效的 html。

要解决此问题,请从 footer.jsp 和 top_and_left.jsp 中删除所有额外的内容。删除等。文件应该只包含你想要的html注入你的身体。这可能会解决您的大部分问题。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文