Jump to content
  • Sign Up
  • 0

Блок страницы всегда сверху шапки


iiwanc
 Share

Question

Здравствуйте!
С недавних пор изучаю HTML.
Раньше писал простой код, но сейчас решил вносить новые веяния.
Пишу лендинг для себя.

Шапка сайта закреплена, и при прокрутки страницы, всегда видна.
Написал блок навыков:

<div class="blok-navik">
            <div>
        <h3>HTML и CSS</h3>
        <p>Использую этот язык</p>
        </div>
            <div>
        <h3>Непрерывность работы IT-инфраструктуры</h3>
        <p>Непрерывность работы и доступности IT-инфраструктуры: IP-видеонаблюдение, сетевое оборудование, антивирусный контроль</p>
        </div>
            <div>
        <h3>Модульный ремонт</h3>
        <p>Диагностика неисправностей компьютеров и локальной сети, прокладка ЛВС, обслуживание офисной АТС и ее инфраструктуры</p>
        </div>
        <div>
        <h3>Модернизация</h3>
        <p>Подготовка предложений по модернизации, приобретению сетевого и офисного оборудования. В ходе модернизаций мною переработана структура локальной сети</p>
        </div>
        <div>
        <h3>Педагогика</h3>
        <p>Преподавание компьютерной грамотности и ведение документации по курсам. Разработка учебных материалов. Составление ТКУ и конспекта урока</p>
        </div>
        <div>
        <h3>Психология и культурология</h3>
        <p>Изучаю психологию взаимодействия индивидуумов в социуме. Культурология позволяет выстроить более продуктивное взаимодействие с обучающимся</p>
        </div>
    </div>

CSS:

.blok-navik { /* Блок навыков */
    padding: 0 8% 0 8%; /* Поля */
    text-align: center; 
    font-family: 'Montserrat', sans-serif;
    font-size: 18px;
      display: flex;
  flex-wrap: wrap;
  align-content: center;
  background: #fff1f1;
  position: absolute;
   }
.blok-navik div {
  width: 30%;
  height:200px;
    color: #000; /* Цвет текста */
    padding: 2px; /* Поля вокруг текста */
    transition: 0.5s linear; /* Время изменения */
    border-bottom: 4px solid #ff3333;
  margin: 15px;
  background: #fff;
  box-shadow: 0 0 7px #a0a0a0;
}
   .blok-navik div:hover {
    color: #fff; /* Цвет текста */
    background: #ff3333; /* Цвет фона */
   }

Почему-то если докрутить страницу до блока навыков, этот блок навыков оказывается сверху шапки.
Как этот блок поместить слоем ниже, под шапкой?

Буду благодарен советам.
Если нужна дополнительная информация или код, то сообщу.
Сайт пока только на компьютере, на OpenServere крутится.

header.php:

  <body>
 <div class="navbar">
 <a href="index.php"><img src="https://www.cyberforum.ru/images/logo2.png"></a>
 <a class="punkt" href="o_saite.php">O сайте</a>
 <a class="punkt" href="forma-svjazi.php">Контакты</a>
 <a class="punkt" href="new2.php">Статьи</a>
 <a class="punkt" href="index.php">Главная</a>
    <a class="menu-triger" href="#"></a>
        <div class="menu-popup">
            <a class="menu-close" href="#"></a>
            <ul class="mob">
                <li><a href="#news">Новости</a></li> 
                <li><a href="forma-svjazi.php">Контакты</a></li>
                <li><a href="o_saite.php">O сайте</a></li>     
                <li><a href="#">Прайс-лист</a></li>
                <li><a href="#">Услуги</a></li>
                <li><a href="#">Гарантии</a></li>
                <li><a href="#">Контакты</a></li>
            </ul>                       
        </div>
<script src="js/jquery.min.js"></script>
<script src="js/mobile.js"></script>
</div>
<div class="main">
</div>
  </body>

style-header.css:

.navbar img {
    float: left;
    display: block;
    text-align: center;
    padding: 1% 0 1% 10%;
    text-decoration: none;
}
 /* The navigation bar */
.navbar {
    overflow: visible;/* Отвечает за отображение мобильного меню в полный размер */
    background-color: rgba(6, 22, 52, 0.9);
    position: fixed; /* Set the navbar to fixed position */
    top: 0; /* Position the navbar at the top of the page */
    width: 100%; /* Full width */
    font-family: 'Montserrat', sans-serif;
}
 
/* Links inside the navbar */
.punkt {
    float: right;
    display: block;
    color: #ffffff;
    text-align: center;
    padding: 14px 16px;
    text-decoration: none;
    top: 50%;
    left: 50%;
    transform: translate(-70%, 20%);
}
 
/* Change background on mouse-over */
.punkt:hover {
    color: #ff3333;
}
/* Main content */
.main {
    margin-top: 70px; /* Add a top margin to avoid content overlay */
}
@media (min-width: 767px) {
    .mob {
        display: none;
    }
}
 
@media (max-width: 767px) {
    .punkt {
        display: none;
    }
 
.menu-triger {
    background: url(../images/menu.png) 0 0 repeat;
    display: block;
    width: 25px;
    height: 17px;
    position: absolute;
    right: 15px;
    top: 40%;
}   
.menu-close {
    background: url(../images/close.png) 0 0 repeat;
    display: block;
    width: 28px;
    height: 28px;
    position: absolute;
    right: 20px;
    top: 20px;
    z-index: 100;
}
.menu-popup {
    background: #061634;
    display: none;
    position: absolute;
    right: -110%;
    top: 0;
    width: 250px;
    box-sizing: border-box;
    padding: 30px;
    z-index: 9999;  
    box-shadow: 0 14px 28px rgba(0,0,0,0.25), 0 10px 10px rgba(0,0,0,0.22);
}
.menu-popup ul {
    margin: 0;
    padding: 0;
}
.menu-popup li {
    list-style: none;
    margin: 10px 0;
    padding: 0;
}
.menu-popup li a {
    font-size: 18px;
    font-family: 'Montserrat', sans-serif;
    color: rgb(255, 255, 255);
    line-height: 1.4;   
    text-decoration: none;
}
.body_pointer * {
    cursor: pointer;
}
}

 

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

спасибо за советы.

убрал position: absolute; в стиле блока навыков и теперь работает, как надо.

не ручаюсь за правильность решения :)

а как сделать так, чтобы текст в ячейках блока навыков всегда масштабировался в них?

Дело в том, что, при уменьшении окна браузера, уменьшается размер ячеек, но текст не помещается в них и отображается за границами ячеек.

Пытаюсь адаптировать под мобильные.

Код https://jsfiddle.net/d9z1kgLm/

Link to comment
Share on other sites

  • 0
13.05.2021 в 19:06, iiwanc сказал:

текст не помещается в них и отображается за границами ячеек.

Что-нибудь типа word-wrap: break-word
А лучше ещё и размер шрифта уменьшить

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy