+ -
当前位置:首页 → 问答吧 → 帮忙,相对定位中的绝对定位问题

帮忙,相对定位中的绝对定位问题

时间:2011-05-11

来源:互联网

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>无标题页</title>
    <style type="text/css">
        body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, form, fieldset, input, textarea, p, th, td
        {
            padding: 0;
            margin: 0;
        }
        .TabHeader
        {
            padding-left: 5px;
            padding-right: 5px;
            background: url(Images/TabHeader_Center.gif) repeat-x;
            height: 40px;
            line-height: 40px;
            position: relative;
            left: 0px;
            top: 0px;
            overflow: visible;
        }
        .TabHeaderLeft
        {
            background: url(Images/TabHeader_Left.gif) no-repeat left top;
            width: 5px;
            height: 40px;
            line-height: 40px;
            position: absolute;
            left: -5px;
            top: 0px;
        }
        .TabHeaderRight
        {
            background: url(Images/TabHeader_Right.gif) no-repeat right top;
            width: 5px;
            height: 40px;
            line-height: 40px;
            position: absolute;
            right: -5px;
            top: 0px;
        }
</style>
</head>
<body>
    <form id="form1" runat="server" style="margin-top: 40px; padding-left: 10px; padding-right: 10px;">
    <div style="height: 400px;">
        <div class="TabHeader">
            <div class="TabHeaderLeft" />
            <div class="TabHeaderRight" />
        </div>
    </div>
    </form>
</body>
</html>

为什么两个绝对定位的div显示的位置不正确?
我想把这两个div一个在左边,一个在右边显示。

[ 本帖最后由 anyur 于 2011-5-11 15:32 编辑 ]

作者: anyur   发布时间: 2011-05-11

貌似你掉了个</div>

作者: ch87011   发布时间: 2011-05-11