Продолжение шаблона - теперь с меню.
Добавил полноценное меню, в котором при наведении курсора появляется анимация: слева проявляется вертикальная полоса, а снизу - горизонтальная линия, плавно расширяющаяся «волной». Исходный код будет приведён ниже.
Меню оформлено отдельно, чтобы его можно было легко интегрировать в любой шаблон.
Создаем глобальный блок вставляем куда угодно.
Код
<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);
}
.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: 6px;
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: 4px;
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;
}
/* ---------- Верхнее меню ---------- */
.header {
width: 100%;
background: #3b5998;
height: 70px;
}
.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: -50px;
}
.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: -9px;
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; /* правые блоки уже на 50px меньше */
grid-template-rows: auto auto;
gap: 10px; /* уменьшено на 5px */
margin-top: 2px; /* уменьшено на 5px */
}
/* Левый блок внизу */
.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;
}
/* Размещение правых блоков */
.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; }
}
</style>
</head>
<body>
<!-- МЕНЮ -->
<div class="header">
<div class="header-inner">
<a href="/" class="logo"> Bro <span class="logo-box">usite.pro</span></a>
<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://investforesight.com/wp-content/uploads/2021/05/Depositphotos_29628305_l-2015-1024x717-1024x717.jpg" alt="cover">
</div>
<div class="center-small block">
Маленький блок под центральным$POWERED_BY$
</div>
<div class="bottom-row">
<div class="bottom-left block">Блок слева (широкий)</div>
<div class="right-small block">Нижний блок справа 1</div>
<div class="right-small block">Нижний блок справа 2</div>
<div class="right-small block">
Нижний блок справа 3
</div>
</div>
</div>
</div>
</body>
</html>
