Мегаменю полной ширины не работает, когда я добавляю ширину: 100%CSS

Разбираемся в CSS
Ответить
Anonymous
 Мегаменю полной ширины не работает, когда я добавляю ширину: 100%

Сообщение Anonymous »

Привет, я пытаюсь создать заголовок с мегаменю, используя HTML и собственный CSS. Я попытался установить для мегаменю полную ширину, применив к нему ширину:100%, но это не помогло.
Это мой HTML-код

Код: Выделить всё




IT Company
[*]










d="M 20,29.000046 H 80.000231 C 80.000231,29.000046 94.498839,28.817352 94.532987,66.711331 94.543142,77.980673 90.966081,81.670246 85.259173,81.668997 79.552261,81.667751 75.000211,74.999942 75.000211,74.999942 L 25.000021,25.000058" />





[i]

[url=#]
[/i]
[/url]


[list]

[url=#]About[/url]

[*]
[url=#]Services[/url]



Web Development

[url=#]Front-end[/url]
[*][url=#]Back-end[/url]
[*][url=#]Full-stack[/url]
[/list]

Mobile Development
[list]
[*][url=#]iOS[/url]
[*][url=#]Android[/url]
[*][url=#]Cross-platform[/url]
[/list]

Cloud Services
[list]
[*][url=#]AWS[/url]
[*][url=#]Azure[/url]
[*][url=#]Google Cloud[/url]
[/list]




[*]
[url=#]Technology[/url]

[*]
[url=#]Hire[/url]

[*]
[url=#]Work[/url]

[*]
[url=#]Contact[/url]


[url=#]Let's Talk[/url]




[list]
[*][url=#]About[/url]
[*][url=#]Services[/url]
[*][url=#]Industries[/url]
[*][url=#]Technology[/url]
[*][url=#]Hire[/url]
[*][url=#]Work[/url]
[/list]
[url=/contact-us]Let's Talk[/url]





а это мой CSS

Код: Выделить всё

body {
font-family: 'Poppins', sans-serif;
margin: 0;
padding: 0;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
-webkit-tap-highlight-color: transparent;
-webkit-user-select: none;
-khtml-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
}

.container {
max-width: auto;
margin: 0 auto;
}

header {
position: sticky;
top: 0;
width: 100%;
z-index: 1000;
}

.navbar-container {
padding-left: 2%;
align-items: center;
width: min-content;
}

.navbar {
display: flex;
align-items: center;
justify-content: space-evenly;
padding: 1rem 2rem;
background: transparent;
transition: background 0.3s ease;
height: 80px;
}

.navbar.scrolled {
background: rgba(255, 254, 254, 0.4);
backdrop-filter: blur(8px);
-webkit-backdrop-filter: blur(8px);
}

.logo img {
height: 60px;
}

.nav-menu {
position: relative;
display: flex;
list-style: none;
margin: 0;
padding: 0;
flex: 1;
justify-content: center;
}

.nav-item {
position: relative;
}

.nav-link {
font-weight: 600;
color: #252B33;
text-decoration: none;
padding: 0.75rem 1.2rem;
display: block;
text-align: center;
min-width: 70px;
transition: background 0.3s ease, color 0.3s ease;
font-size: 1.05em;
}

.nav-link:hover,
.nav-link:focus {
color: #0263E0;
}

.menu-icon {
display: block;
cursor: pointer;
font-size: 24px;
transition: transform 0.3s ease;
}

.mega-menu {
position: absolute;
top: 100%;
left: 0;
right: 0;
display: none;
background-color: #fff;
box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);

}

.nav-item:hover .mega-menu {
display: block;
animation: cardDrop 0.5s forwards;
}

.dropdown:hover .mega-menu {
display: block;
}

.mega-menu-content {
display: flex;
justify-content: space-around;
padding: 20px;
}

.mega-menu-section {
flex: 1;
padding: 20px;
}

.mega-menu-section h3 {
margin-top: 0;
}

.mega-menu-section ul {
list-style: none;
padding: 0;
}

.mega-menu-section li {
margin: 0.5rem 0;
}

.mega-menu-section a {
color: #333;
text-decoration: none;
}

.cta-button {
background: #0263E0;
color: #fff;
padding: 1.05rem 2.0rem;
border-radius: 10px;
line-height: 14px;
text-decoration: none;
margin-left: 1rem;
transition: background 0.3s ease;
box-shadow: 0 20px 40px rgba(2, 99, 224, .15);
}

.cta-button:hover,
.cta-button:focus {
background: #202c4a;
}

.drawer {
position: fixed;
top: 90px;
left: -100%;
width: 100%;
height: calc(100% - 80px);
background: rgba(255, 254, 254, 0.4);
color: #252B33;
z-index: 1001;
transition: left 0.3s ease;
backdrop-filter: blur(8px);
-webkit-backdrop-filter: blur(8px);
}

.drawer.open {
left: 0;
}

.drawer-content {
padding: 2rem;
display: flex;
flex-direction: column;
justify-content: space-between;
height: 90%;
}

.drawer-content ul {
list-style: none;
padding: 0;
}

.contact-button {
text-decoration: none;
color: #0263E0;
}

.contact-icon {
display: none;
cursor: pointer;
font-size: 24px;
transition: transform 0.3s ease;
}

.drawer-content li {
margin: 1rem 0;
}

.drawer-content .drawer-menu {
font-size: 32px;
color: #252B33;
text-decoration: none;
font-weight: 600;
text-align: left;
align-items: left;
line-height: normal;
padding: 8px 15px;
}

.drawer-content .drawer-menu:hover,
.drawer-content .drawer-menu:focus {
color: #ddd;
}

.drawer-cta-button {
background: #0263E0;
color: #fff;
padding:  1.05rem 2.0rem;
border-radius: 10px;
line-height: 20px;
text-decoration: none;
transition: background 0.3s ease;
text-align: center;
margin-top: auto;
/* Push the button to the bottom */

}

.drawer-cta-button:hover,
.drawer-cta-button:focus {
background: #202c4a;
}

.menu {
margin-right: 20px;
background-color: transparent;
border: none;
cursor: pointer;
display: none;
padding: 0;
}

.line {
fill: none;
stroke: black;
stroke-width: 6;
transition: stroke-dasharray 600ms cubic-bezier(0.4, 0, 0.2, 1),
stroke-dashoffset 600ms cubic-bezier(0.4, 0, 0.2, 1);
}

.line1 {
stroke-dasharray: 60 207;
stroke-width: 6;
}

.line2 {
stroke-dasharray: 60 60;
stroke-width: 6;
}

.line3 {
stroke-dasharray: 60 207;
stroke-width: 6;
}

.opened .line1 {
stroke-dasharray: 90 207;
stroke-dashoffset: -134;
stroke-width: 6;
}

.opened .line2 {
stroke-dasharray: 1 60;
stroke-dashoffset: -30;
stroke-width: 6;
}

.opened .line3 {
stroke-dasharray: 90 207;
stroke-dashoffset: -134;
stroke-width: 6;
}

@media (max-width: 768px) {
.navbar {
margin-top: 10px;
}

.nav-menu {
display: none;
}

.menu-icon {
display: block;
}

.cta-button {
display: none;
}

.menu {
display: flex;
}

.menu-icon,
.contact-icon {
display: block;
}

.navbar-container {
display: flex;
width: 100%;
justify-content: space-evenly;
}

.contact-icon {
display: block;
margin-left: auto;
}
}

@media (min-width: 769px) and (max-width: 1024px) {
.navbar {
margin-top: 10px;
}

.nav-menu {
display: none;
}

.menu-icon {
display: block;
}

.cta-button {
display: none;
}

.menu {
display: flex;
}

.menu-icon,
.contact-icon {
display: block;
}

.navbar-container {
display: flex;
width: 100%;
justify-content: space-evenly;
}

.contact-icon {
display: block;
margin-left: auto;
}

.mega-menu {
left: 100%;
}

.mega-menu::before {
left: 40%;
}
.drawer-content .drawer-menu {
font-size: 48px;
font-weight: 800;
}
.drawer-content
{
align-items: center;
}
.drawer-cta-button
{
width: 80%;
}
}

@keyframes cardDrop {
0% {
opacity: 0;
transform: translateY(-20px);
}
100% {
opacity: 1;
transform: translateY(0);
}
}
Я пытался задать ширину .mega-menu: 100%, но она не охватывает всю ширину. Я попробовал ширину: 1920 пикселей, но все равно не переходит на полную ширину. Есть ли другой способ сделать это?

Подробнее здесь: https://stackoverflow.com/questions/786 ... d-width100
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «CSS»