span 和 div 的定位问题

发布于 2024-10-15 06:28:47 字数 3931 浏览 4 评论 0原文

首先,我不是这方面的专家,但我喜欢尝试改进...

这是我的问题 http://kebax.dk/testdesign/?page=classes

这是后面的代码

...
<body>
<div id="outercontainer">
    <div id="navpanel">
        <h3>Navigate:</h3>
        <a href="?page=home">Home</a><br />
        <a href="?page=generalinfo">General info</a><br />
        <a href="?page=classes">Classes</a><br />
        <a href="?page=skills">Skills &amp; Mounts</a><br />
        <a href="?page=proffs">Professions</a><br />
        <a href="?page=guild">Guild</a><br />
        <a href="?page=travel">Travelling</a><br />
        <a href="?page=aution">Auctionhouse</a><br />
        <a href="?page=pvp">PvP</a><br />
        <a href="?page=raids">Raids &amp; Roles</a><br /><br />
    </div>
    <div id="container">
        <?php
           php-include script
        ?>
        <span><center><hr />Copyright &copy;2011 my name</center></span>
    </div>
</div>
</body>
...

这是 LESS 样式表:

h2 {
    font-family: 'Orbitron';
    font-weight: bold;
    color: #fff;
    .shadowtext(2px, 2px, 5px, #ddd);
}

h3 {
    font-family: 'Orbitron';
    font-weight: bold;
    color: #000;
    .shadowtext(2px, 2px, 5px, #333);
}

#outercontainer {
    width: 920px;
    min-height: 100%;
    margin-left:auto;
    margin-right:auto;
    margin-top:25px;
    margin-bottom: 25px;
    height:auto !important;
    height:100%;
    padding:0px;


    #navpanel {
        width: 150px;
        margin:auto;
        padding:5px;
        .rounded();
        background: @bgcolor_nav;
        position:relative;
        float:left;
        -webkit-border-top-right-radius: 0px;
        -moz-border-radius-topright: 0px;
        border-top-right-radius: 0px;
        .shadow(5px, 5px, 10px, #666);

        a, a:active {
            color: #fff;
            font-size: 9pt;
        }

        a:hover {
            color: #ccc;
            font-size: 9pt;
        }
    }

    #container {
        width: 750px;
        margin:auto;
        background: @bgcolor;
        font-size: 10pt;
        .rounded();
        padding: 5px;
        position:relative;
        .shadow(5px, 5px, 10px, #666);

        -webkit-border-top-left-radius: 0px;
        -moz-border-radius-topleft: 0px;
        border-top-left-radius: 0px;

        a, a:active {
            color: #fff;
            font-size: 12pt;
        }

        a:hover {
            color: #ccc;
            font-size: 12pt;
        }

        p {
            color: #fff;
            position:relative;
        }
        float:right;

        span {
            bottom:0px;
            position:relative;
            hr {
                height:1px;
                background:#000;
                border:0px;
                .shadow(2px, 2px, 2px, #666);
            }

        }

    }
}

#classpanel {
    border:1px solid black;
    width:150px;
    height:200px;
    position:relative;
    float:right;
    top:-220px;
    background:#000;

    a, a:active {
        color: #fff;
        font-size: 8pt;
    }

    a:hover {
        color: #ccc;
        font-size: 8pt;
    }
}

我的问题是,无论页面内容如何,​​底部的跨度都必须保留在底部。但我插入的 classpanel div 似乎干扰了我的版权领域。 这就是我想要的样子:)

=============================
| Header         ---------- |
| container      | class  | |
|    for         |  panel | |
|   contents     |        | |
|                ---------- |
|                           |
| ------------------------- |
|        Copyright span     |
=============================

我希望你能帮助我......

First of all, I'm not an expert on this, but I like trying to improve...

This is my problem http://kebax.dk/testdesign/?page=classes.

And here's the code behind

...
<body>
<div id="outercontainer">
    <div id="navpanel">
        <h3>Navigate:</h3>
        <a href="?page=home">Home</a><br />
        <a href="?page=generalinfo">General info</a><br />
        <a href="?page=classes">Classes</a><br />
        <a href="?page=skills">Skills & Mounts</a><br />
        <a href="?page=proffs">Professions</a><br />
        <a href="?page=guild">Guild</a><br />
        <a href="?page=travel">Travelling</a><br />
        <a href="?page=aution">Auctionhouse</a><br />
        <a href="?page=pvp">PvP</a><br />
        <a href="?page=raids">Raids & Roles</a><br /><br />
    </div>
    <div id="container">
        <?php
           php-include script
        ?>
        <span><center><hr />Copyright ©2011 my name</center></span>
    </div>
</div>
</body>
...

And here's the LESS style sheet:

h2 {
    font-family: 'Orbitron';
    font-weight: bold;
    color: #fff;
    .shadowtext(2px, 2px, 5px, #ddd);
}

h3 {
    font-family: 'Orbitron';
    font-weight: bold;
    color: #000;
    .shadowtext(2px, 2px, 5px, #333);
}

#outercontainer {
    width: 920px;
    min-height: 100%;
    margin-left:auto;
    margin-right:auto;
    margin-top:25px;
    margin-bottom: 25px;
    height:auto !important;
    height:100%;
    padding:0px;


    #navpanel {
        width: 150px;
        margin:auto;
        padding:5px;
        .rounded();
        background: @bgcolor_nav;
        position:relative;
        float:left;
        -webkit-border-top-right-radius: 0px;
        -moz-border-radius-topright: 0px;
        border-top-right-radius: 0px;
        .shadow(5px, 5px, 10px, #666);

        a, a:active {
            color: #fff;
            font-size: 9pt;
        }

        a:hover {
            color: #ccc;
            font-size: 9pt;
        }
    }

    #container {
        width: 750px;
        margin:auto;
        background: @bgcolor;
        font-size: 10pt;
        .rounded();
        padding: 5px;
        position:relative;
        .shadow(5px, 5px, 10px, #666);

        -webkit-border-top-left-radius: 0px;
        -moz-border-radius-topleft: 0px;
        border-top-left-radius: 0px;

        a, a:active {
            color: #fff;
            font-size: 12pt;
        }

        a:hover {
            color: #ccc;
            font-size: 12pt;
        }

        p {
            color: #fff;
            position:relative;
        }
        float:right;

        span {
            bottom:0px;
            position:relative;
            hr {
                height:1px;
                background:#000;
                border:0px;
                .shadow(2px, 2px, 2px, #666);
            }

        }

    }
}

#classpanel {
    border:1px solid black;
    width:150px;
    height:200px;
    position:relative;
    float:right;
    top:-220px;
    background:#000;

    a, a:active {
        color: #fff;
        font-size: 8pt;
    }

    a:hover {
        color: #ccc;
        font-size: 8pt;
    }
}

My problem is that this span at the bottom has to stay at the bottom no matter the contents of the page. But the classpanel div i inserted seems to be interfering with my copyright field.
And here's how I want it to look like :)

=============================
| Header         ---------- |
| container      | class  | |
|    for         |  panel | |
|   contents     |        | |
|                ---------- |
|                           |
| ------------------------- |
|        Copyright span     |
=============================

I hope you can help me out...

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

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

发布评论

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

评论(1

甜是你 2024-10-22 06:28:47

那个页面不太好。

在 Chrome/Firefox 中测试,如果我将 clear: Both 添加到您的

标记 (???),页脚将转到底部。


你真的应该改变这个:

<span><center><hr />Copyright ©2011 Kristian Bak</center></span>

变成更像这样的东西:(

<div id="footer" style="clear:both; border-top:1px solid #000; text-align: center; padding: 6px 0">
    Copyright ©2011 Kristian Bak
</div>

显然是用样式表中的内联样式代替)

That page isn't great.

Testing in Chrome/Firefox, if I add clear: both to your <center> tag (???), the footer goes to the bottom.


You should really change this:

<span><center><hr />Copyright ©2011 Kristian Bak</center></span>

into something more like this:

<div id="footer" style="clear:both; border-top:1px solid #000; text-align: center; padding: 6px 0">
    Copyright ©2011 Kristian Bak
</div>

(obviously with the inline styles in your stylesheet instead)

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