A
A
Alexey Chertok2014-07-29 11:52:28
css
Alexey Chertok, 2014-07-29 11:52:28

How to fix a column in the center regardless of the scrollbar?

Good afternoon.

There are two containers:

<header class="topPage" style="width:100%;height:50px;position:fixed;top:0;left:0;">
    <div class="wrap" style="margin:0 auto;width:860px;">
    </div>
</header>

<section class="centerPage" style="width:100%;position:relative;padding-top:50px; display:inline-block">
    <div class="wrap" style="margin:0 auto;width:860px;">
    </div>
</section>


How to fix everything exactly in the center, so that when a page scroll appears, it does not jump to the left? Following the example of how it was done on the site vkontakte.ru.

If they have / do not have a scroll, the page in the center is motionless. Who can help? Does anyone know if this can be implemented.

Thanks in advance.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vitaly Kirenkov, 2014-07-29
@DeLaVega

body { overflow: scroll;}

E
evnuh, 2014-07-29
@evnuh

Try to do not margin but padding

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question