Проблемы с боковой панелью - несмотря на положение: исправленная боковая панель не останется на своем месте. Код и изображение включены - PullRequest
2 голосов
/ 16 марта 2012

Это моя первая попытка и разработка / кодирование сайта самостоятельно, и я уже многому научился, и пока я делаю последние штрихи, я не могу исправить эту последнюю проблему. В идеале боковая панель должна быть в фиксированном положении в крайнем правом положении, горизонтально на уровне с навигационной панелью на левой стороне. В настоящее время он располагается поверх основного содержимого рядом с заголовком / навигацией слева.

enter image description here

header {
    background: none;
    float: left;
    margin-top: 123px;
    margin-left: 22px;
    position: fixed;
    width: 158px; 
}
#main {
    float: left;
    margin-left: 300px;
    margin-top: 310px;
}
#sidebar {
    border-top: 1px solid #202020;
    float: right;
    height: 100%;
    margin-left: 252px;
    margin-top: 295px;
    padding-top: 25px;
    position: fixed;
    width: 158px;
}

    <header>
        <div id="logo">
            <a href="#"><img src="img/logo.png" alt="whskytngfxtrt logo" height="139" width="158" /></a>
        </div><!-- end logo -->
        <nav>
            <ul>
                <li id="blog"><a href="#">BLOG</a></li>
                <li id="work"><a href="#">WORK</a></li>
                <li id="about"><a href="#">ABOUT</a></li>
                <li id="contact"><a href="#">CONTACT</a></li>
            </ul>
        </nav><!-- end nav -->
    </header><!-- end header -->

    <div id="main">
        <article>
            <h1><a href="#">Clever Headline</a></h1>
            <h2 class="postinfo">
            <ul>
                <li>Posted by <a href="#">Alex Chennault</a></li>
                <li>1st March 2012</li>
                <li>tags: <a href="#">cool</a>, <a href="#">awesome</a></li>
            </ul>
            </h2>
            <p>One morning, when Gregor Samsa woke from troubled dreams, he found himself transformed in his bed into a horrible vermin. He lay on his armour-like back, and if he lifted his head a little he could see his brown belly, slightly domed and divided by arches into stiff sections. The bedding was hardly able to cover it and seemed ready to slide off any moment. His many legs, pitifully thin compared with the size of the rest of him, waved about helplessly as he looked. "What's happened to me? " he thought. It wasn't a dream. His room, a proper human room although a little too small, lay peacefully between its four familiar walls. A collection of textile samples lay spread out on the table - Samsa was a travelling salesman - and above it there hung a picture that he had recently cut out of an illustrated magazine and housed in a nice, gilded frame. It showed a lady fitted out with a fur hat and fur boa who sat upright, raising a heavy fur muff that covered the whole of her lower arm towards the viewer.</p>
        </article><!-- end article -->
    </div><!-- end main -->

    <div id="sidebar">
        <section id="dictionary">
            <h3><b>hwis-kee tang-goh foks-trot</b></h3>
            <h4><p><i>noun</i> 1. the best damn creative studio there ever was</p></h4>
        </section><!-- end dictionary -->

        <section id="twitter">
            <h3><a href="http://www.twitter.com/whskytngfxtrt">@whskytngfxtrt</a></h3>
            <h4><ul>
                <li><a href="#">sometimes i just really love the internet</a></li>
                <li><a href="#">sometimes i just really love the internet</a></li>
                <li><a href="#">sometimes i just really love the internet</a></li>
            </ul></h4>
        </section><!-- end twitter-feed -->
    </div><!-- end sidebar -->

1 Ответ

0 голосов
/ 17 марта 2012

Пара вещей, которые вы, возможно, захотите настроить:

  1. Вы добавляете некоторые свойства в правило стиля, которые понижают содержание, а именно:

    margin-top: 295px;
    padding-top: 25px; 
    

    Возможно, вы захотите уменьшить или исключить их.

  2. У вас есть позиция, установленная на fixed, но вы не используете какие-либо свойства, специфичные для нее, чтобы установить позицию, например,top, left.Вы можете прочитать немного больше здесь: http://reference.sitepoint.com/css/position

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...