Список пользователей

1
Админ
Постов: 162
2
Элита
Постов: 45
3
VIP
Постов: 35
4
Проверенные
Постов: 31
5
Проверенные
Постов: 30
6
Пользователи
Постов: 27
7
VIP
Постов: 26
8
Пользователи
Постов: 24

  • Страница 1 из 1
  • 1
Фиксируем блоки и верхнюю панель - ВК шаблон UCOZ
Дата: Пятница, 19.12.2025, 19:43 | Сообщение # 1 | | Написал: Узнаваемый
Автор темы
Мурчанн не в сети
        Сообщений:162
         Регистрация:20.10.2016

Посмотрел, как устроен шаблон ВКонтакте, и стало ясно: левое меню там вполне себе «живое», не жёстко зафиксированное. Фиксированными остаются лишь отдельные блоки — подарки, друзья, подписки. Мы можем пойти тем же путём.

Что‑то возьмём из старых версий шаблонов — не всё новое действительно лучше старого. Например, текущее размещение аватарки мне не особо нравится: в старом ВК оно выглядело гораздо гармоничнее. Но наша цель — не копирование, а создание собственной версии под uCoz.

Мы будем разрабатывать всё с нуля: скрипты, логику, отдельные элементы интерфейса — только тот функционал, который действительно нужен. Без перегруза, без лишнего шума. Двигаемся не в сторону «монстров», а в сторону эстетики: просто, аккуратно и красиво.

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

А иначе зачем создавать таких монстров.

Поэтому берите шаблон как основу, экспериментируйте, создавайте свои версии сайтов.

Я, в свою очередь, буду постепенно выкладывать свои наработки.



Меню

Код
<img src="https://bro.usite.pro/img/bro.jpg" alt="" style="width:100%; height:200px; background:#000; margin-bottom:15px;">
<h3>My Profile</h3>

<style>
body {
margin: 0;
font-family: Arial, sans-serif;
background: #f0f2f5;
}

.topbar {
  width: 100%;
  height: 50px;
  background: #2a5885;
  display: flex;
  align-items: center;
  padding: 0 15px;
  color: #fff;
  box-shadow: 0 2px 4px rgba(0,0,0,0.2);

  position: fixed;  /* закрепляем */
  top: 0;
  left: 0;
  z-index: 1000;   /* чтобы быть поверх всего */
}

.topbar .logo {
font-weight: bold;
font-size: 20px;
margin-right: 25px;
}
.topbar input {
border: none;
border-radius: 5px;
padding: 6px 10px;
width: 250px;
}

.sidebar a {
display: block;
padding: 10px 8px;
margin-bottom: 2px;
text-decoration: none;
color: #1d1d1d;
font-size: 15px;
border-radius: 0px;
}
.sidebar a:hover {
background: #e7eaf0;
}

/* Добавляем левую вертикальную линию при наведении */
.sidebar a {
position: relative;
overflow: hidden;
}

/* Горизонтальная линия под пунктом */
.sidebar a::after {
content: "";
position: absolute;
bottom: 0;
left: 50%;
width: 100%;
height: 1px;
background: #2a5885; /* синяя полоска */
transform: translateX(-50%) scaleX(0);
transform-origin: center;
transition: 1.93s;
}

.sidebar a:hover::after {
transform: translateX(-50%) scaleX(1);
}

.sidebar a::before {
content: "";
position: absolute;
left: -2px;
top: 0;
width: 5px;
height: 100%;
background: transparent;
transition: 0.95s;
}

/* 7 разных цветов */ для 7 пунктов */
.sidebar a:nth-child(1):hover::before { background: #3b82f6; }
.sidebar a:nth-child(1):hover::after { background: #3b82f6; }

.sidebar a:nth-child(2):hover::before { background: #10b981; }
.sidebar a:nth-child(2):hover::after { background: #10b981; }

.sidebar a:nth-child(3):hover::before { background: #f59e0b; }
.sidebar a:nth-child(3):hover::after { background: #f59e0b; }

.sidebar a:nth-child(4):hover::before { background: #ef4444; }
.sidebar a:nth-child(4):hover::after { background: #ef4444; }

.sidebar a:nth-child(5):hover::before { background: #8b5cf6; }
.sidebar a:nth-child(5):hover::after { background: #8b5cf6; }

.sidebar a:nth-child(6):hover::before { background: #ec4899; }
.sidebar a:nth-child(6):hover::after { background: #ec4899; }

.sidebar a:nth-child(7):hover::before { background: #14b8a6; }
.sidebar a:nth-child(7):hover::after { background: #14b8a6; }

</style>

<div class="sidebar">
<a href="#">Моя страница</a>
<a href="#">Новости</a>
<a href="#">Сообщения</a>
<a href="#">Друзья</a>
<a href="#">Группы</a>
<a href="#">Фотографии</a>
<a href="#">Настройки</a>
</div>


Главная страница каталога статей .

Код
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>BRO Account</title>
<style>

/* ---------- Общие настройки ---------- */
* { box-sizing: border-box; }

body {
  margin: 0;
  background: #e9ebee;
  font-family: Arial, sans-serif;
  -webkit-font-smoothing: antialiased;

  padding-top: 65px; /*  отступ под фиксированную шапку */
}

/* ---------- Верхнее меню ---------- */
.header {
  width: 100%;
  background: #3b5998;
  height: 65px;

  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
}

.header-inner {
width: 1035px;
max-width: calc(100% - 40px);
margin: 0 auto;
height: 100%;
position: relative;
top: 10px;
}

.logo {
position: absolute;
top: 12px;
left: 0;
color: #fff;
font-weight: bold;
font-size: 22px;
text-decoration: none;
margin-left: -49px;
}

.logo-box {
background: #fff;
color: #0a66c2;
padding: 2px 6px;
margin-left: 2px;
border-radius: 2px;
}

.nav-cta-wrapper {
position: absolute;
bottom: 25px;
right: 0;
display: flex;
gap: 15px;
}

.nav-cta {
width: 25px;
height: 25px;
background: #fff;
border-radius: 50%;
}

/* ---------- Сетка (контент) ---------- */
.container {
width: 1135px;
max-width: calc(100% - 40px);
margin: 15px auto;
display: grid;
grid-template-columns: 210px 1fr; /* левая колонка фикс, центральная гибкая */
grid-gap: 10px; /* уменьшено на 5px */
align-items: start;
}

.block {
background: #fff; /* все блоки белые */
padding: 15px;
border-radius: 5px;
box-shadow: 0 1px 3px rgba(0,0,0,0.12);
}

/* Левая колонка */
.left-col {
grid-row: span 2;
padding-top: 10px;
}

.left-col h3 { margin: 0 0 6px 0; padding-left: 8px; letter-spacing: 3px;}
.left-col p { margin: 0 0 12px 0; color:#666; }
.left-col ul { padding-left: 18px; margin: 0; color:#333; }
.left-col ul li { margin: 6px 0; }

/* Центральная колонка */
.center-col {
display: flex;
flex-direction: column;
}

/* Большая обложка */
.cover {
width: 100%;
height: 300px;
margin-bottom: 10px; /* уменьшено на 5px */
overflow: hidden;
border-radius: 2px;
}
.cover img {
width: 100%;
height: 100%;
object-fit: cover;
display:block;
}

/* Маленький центральный блок — уже */
.center-small {
margin-top: -10px;
height: 40px;
display: flex;
align-items: center;
justify-content: left;
padding-left: 10px;
text-align: center;
background: #fff; /* белый фон */
border-top: 0px solid #bfc1c4;
border-left: none;
border-right: none;
border-bottom: none;
border-radius: 0 !important;
margin-bottom: 10px; /* уменьшено на 5px */
}

/* ---------- Нижний ряд ---------- */
.bottom-row {
  grid-column: 2;
  display: grid;
  grid-template-columns: 1fr 320px;
  grid-template-rows: auto auto;
  gap: 10px;
  margin-top: 2px;
  align-items: start; /* ВАЖНО */

}

/* Левый блок внизу */
.bottom-left {
grid-column: 1 / 2;
grid-row: 1 / span 2;
min-height: 150px;
background: #fff;
border-radius: 0;
border: 1px solid #d8dce1;
padding: 10px;

}

.right-small {
  display: flex;
  align-items: center;
  justify-content: left;
  min-height: 60px;
  width: 100%;
  background: #fff;
  border-radius: 0;
  border: 1px solid #d8dce1;
  padding: 10px;

  position: sticky;   /* главное */
  top: 75px;           /* ниже фиксированной шапки */
  margin-bottom: 1px; /* добавляем отступ снизу */
}

/* Размещение правых блоков */
.bottom-row > .right-small:nth-of-type(1) { grid-column: 2; grid-row: 1; }
.bottom-row > .right-small:nth-of-type(2) { grid-column: 2; grid-row: 2; }
.bottom-row > .right-small:nth-of-type(3) { grid-column: 2; grid-row: 3; }

/* Визуальные улучшения одинаковых блоков */
.bottom-left,
.right-small,
.center-small {
box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* Мелкая адаптивность */
@media (max-width: 900px) {
.container { grid-template-columns: 1fr; width: calc(100% - 30px); }
.left-col { grid-row: auto; padding-top: 12px; }
.bottom-row { grid-column: 1; grid-template-columns: 1fr; grid-template-rows: auto; }
.bottom-left, .right-small { grid-column: 1; grid-row: auto; }
.cover { height: 220px; }
}

/* ---------- Поиск в шапке ---------- */
.vk-search {
position: absolute;
left: 170px;
top: 10px;
}

.vk-search input {
width: 220px;
height: 32px;
padding: 0 10px 0 34px; /* место под лупу */
border-radius: 8px;
border: 1px solid #2f477a;
background: #fff;
font-size: 14px;
outline: none;
}

.vk-search input::placeholder {
color: #888;
}

.vk-search input:focus {
border-color: #1d3f72;
}

/* ---------- Лупа ---------- */
.vk-search-icon {
position: absolute;
left: 10px;
top: 50%;
width: 17px;
height: 17px;
transform: translateY(-50%);
pointer-events: none;
background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='%23888'%3E%3Cpath d='M10 2a8 8 0 105.293 14.293l4.707 4.707 1.414-1.414-4.707-4.707A8 8 0 0010 2zm0 2a6 6 0 110 12 6 6 0 010-12z'/%3E%3C/svg%3E") no-repeat center;
background-size: contain;
}

.blockbro {
  display: flex;
  flex-direction: column;
  gap: 10px;             /* расстояние между блоками */
  
  position: sticky;       /* липкая колонка */
  top: 85px;              /* ниже фиксированной шапки */
  align-self: start;      /* обязательно для sticky */
}

</style>

</head>
<body>

<!-- МЕНЮ -->
<div class="header">
<div class="header-inner">
<a href="/" class="logo"> Bro <span class="logo-box">usite.pro</span></a>

<form class="vk-search" action="/search" method="get">
<span class="vk-search-icon"></span>
<input type="text" name="q" placeholder="Поиск" />
</form>

<div class="nav-cta-wrapper">
<div class="nav-cta"></div>
<div class="nav-cta"></div>
<div class="nav-cta"></div>
<div class="nav-cta"></div>
</div>
</div>
</div>

<!-- КОНТЕНТ -->
<div class="container">
<!-- Левая колонка -->
<div class="left-col block">

$GLOBAL_MENU$

</div>

<!-- Центральная колонка -->
<div class="center-col">
<div class="cover block">
<img src="https://bro.usite.pro/img/photo01.jpg" alt="cover">
</div>

<div class="center-small block">
Маленький блок под центральным$POWERED_BY$
</div>

<div class="bottom-row">

  <!-- Лента новостей -->

    <div class="bottom-left block">
    $BODY$
  </div>

<!-- Правая колонка (липкая) -->
<div class="right-col blockbro">

  <div class="">
    $GLOBAL_BRO$
  </div>

    <div class="right-small block">
      Нижний блок справа 1
    </div>

    <div class="right-small block">
      Нижний блок справа 2
    </div>

    <div class="right-small block">
      Нижний блок справа 2
    </div>
     

  </div>

</div>

</div>
</div>

</body>
</html>


Мурчанн

Признаюсь, не знаю почему, но глядя на звезды мне всегда хочется мечтать.
  • Страница 1 из 1
  • 1
Поиск: