Я не могу расположить навигационные ссылки на своем веб-сайте в левой части навигационной панели.Html

Программисты Html
Ответить
Anonymous
 Я не могу расположить навигационные ссылки на своем веб-сайте в левой части навигационной панели.

Сообщение Anonymous »

У меня возникли проблемы с выравниванием навигационных ссылок на моем личном веб-сайте. Что бы я ни делал в файле CSS и index.html, ничего не меняется. Ссылки по-прежнему находятся в центре панели навигации. Я попытался переписать файл CSS, но после тестирования на работающем сервере ничего не меняется. Это то, что у меня есть на данный момент.

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

/* Remove default margin and padding, set box-sizing to border-box for easier sizing */
* {
margin: 0;
padding: 0;
box-sizing: border-box;
}

/* Set base font, background color, text color, and line height for the whole page */
body {
font-family: Arial, Helvetica, sans-serif;
background-color: #2e2e2e;
color: #f5f5f5;
line-height: 1.6;
overflow-y: auto;
overscroll-behavior: contain; /* prevents scroll “bouncing” past top/bottom */
}

/* Links */
/* Style links with default color and remove underline */
a {
color: #f5f5f5;
text-decoration: none;
transition: color 0.2s ease; /* Smooth color transition on hover */
}

/* Change link color on hover for visual feedback */
a:hover {
color: #ccc;
}

/* Header & nav */
/* Style the header with background, padding, fixed position, shadow, and layering */
.header {
background: #1f1f1f;
padding: 1rem 2rem;
position: fixed; /* Keeps header visible on scroll */
top: 0;
left: 0;
width: 100%;
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3); /* Adds subtle shadow below header */
z-index: 1000; /* Ensures header stays on top of other elements */
}

/* Logo styling with larger, bold font */
.logo {
font-size: 1.5rem;
font-weight: bolder;
}

/* Main content */
/* Container for main content with max width and margin for spacing */
main {
margin-top: 80px; /* same as header height */
max-width: 800px;
margin: 80px auto 4rem; /* top margin = header height (approx 80px) */
padding: 0 1rem;
min-height: 2000px;
}

/* Intro section centered with bottom margin */
.intro {
text-align: center;
margin-bottom: 3rem;
}

/* Main heading size and spacing */
.intro h1 {
font-size: 2.5rem;
margin-bottom: 1rem;
}

/* Recent posts heading spacing */
.recent-posts h2 {
margin-bottom: 1.5rem;
}

/* Individual post styling with background, padding, rounded corners, margin, and transition */
.post {
background: #3a3a3a;
padding: 1.5rem;
border-radius: 8px;
margin-bottom: 2rem;
transition: background 0.3s ease; /* Smooth background color change on hover */
}

/* Darker background on hover for posts */
.post:hover {
background: #4a4a4a;
}

/* Footer */
/* Centered footer with padding, background, lighter text color, and smaller font */
.footer {
text-align: center;
padding: 1.5rem;
background: #1f1f1f;
color: #aaa;
font-size: 0.9rem;
}

/* List of posts without default list styling and spacing */
.post-list {
list-style: none; /* Remove bullets */
padding: 0;
margin-top: 2rem;
}

/* Individual list items styled similar to posts */
.post-list li {
background: #3a3a3a;
margin-bottom: 1rem;
padding: 1rem;
border-radius: 6px;
transition: background 0.3s ease; /* Smooth background change on hover */
}

/* Darker background on hover for list items */
.post-list li:hover {
background: #4a4a4a;
}

/* Links inside post list with color and bold font */
.post-list a {
color: #f5f5f5;
font-weight: bold;
}

.navbar {
display: flex;
justify-content: space-between; /* pushes nav-links left, social-links right */
align-items: center;
width: 100%;
max-width: 1000px;
margin: 0 auto;

}

.nav-links {
display: flex;
justify-content: flex-start; /* align links to the left */
gap: 2.5rem; /* spacing between links */
margin-left: 10; /* remove any default left margin */
padding-left: 10; /* remove any default left padding */
}

.social-links {
display: flex;
justify-content: flex-end; /* keep icons to the right */
gap: 1.5rem;  /* spacing between icons */
}

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




Blog - My Name











[url=index.html]My Name[/url]


[url=blog.html]Blog[/url]
[url=#]About[/url]
[url=#]Gear[/url]

[url=https://x.com]
[i][/i]
[/url]
[url=https://www.instagram.com]
[i][/i]
[/url]
[url=https://github.com]
[i][/i]
[/url]








Welcome to my site
Hi, I'm "My Name". This is my personal space where I write about coding, tech, and life.







Подробнее здесь: https://stackoverflow.com/questions/798 ... side-of-th
Ответить

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

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

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

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

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