Как растянуть шапку да и впринципе весь сайт на ширину сайта?

Всем привет! Пишу сайт-визитку и возникла проблема что при открытии на телефон сайт искажается (узнал про верстку сайта только сейчас) в итоге у меня все блоки как будто прижимаются к левой части и чтобы растянуться им на всю ширину им что то мешает. Прикладываю скрин, html и css коды

введите сюда описание изображения

body {
    width: 100%;
    min-width: 100%;
    display: auto;
    font-family: 'Raleway', sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f8f8f8;
    color: #333;
    overflow-x: hidden;
    
}

.container {
    max-width: 100%;
    margin: 0 auto;
    padding: 20px;
    
}

header {
    width: 100%;
    
    max-width: 100%;
    margin: 0 auto;
    box-sizing: border-box; 
    background-color: #282828;
    color: white;
    padding: 20px;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}


.obomne {
    align-items: center; gap: 20px;
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

header h1 {
    margin: 0px;
    font-size: 2rem;
}

header p {
    margin: 5px 0 0;
}

.header-contact a {
    color: #0073e6;
    text-decoration: none;
    margin-right: 15px;
}

.nav {
    background-color: #333;
    color: white;
    position: sticky;
    top: 115px;
    z-index: 1000;
}

.nav ul {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    justify-content: center;
}

.nav ul li {
    margin: 0 15px;
}

.nav ul li a {
    color: white;
    text-decoration: none;
    transition: color 0.3s ease;
}

.nav ul li a:hover {
    color: #ffd700;
}

.nav ul li a.active {
    color: #ffd700;
    border-bottom: 2px solid #ffd700;
}

section {
    padding: 40px 0;
}

section h2 {
    font-size: 1.8rem;
    margin-bottom: 20px;
    text-align: center;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease;
}

section h3 {
    font-size: 1.1rem;
    margin-bottom: 20px;
    text-align: center;
    opacity: 0;
    transform: translateY(20px);
    transition: all 0.6s ease;
}

section.visible h3 {
    opacity: 1;
    transform: translateY(0);
}


section.visible h2 {
    opacity: 1;
    transform: translateY(0);
}

footer {
    background-color: #282828;
    color: white;
    padding: 10px 0;
    text-align: center;
}

.highlight-box {
    background-color: #e3e3e3;
    color: #333;
    padding: 20px;
    border-radius: 10px;
    margin: 20px auto;
    max-width: 800px;
    font-size: 1.2rem;

    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}


.highlight-box:hover {
    transform: translateY(-10px);
}

.services img {
    max-width: 100%;
    height: auto;
    border-radius: 10px;
    margin-top: 20px;
}

.text-box {
    background-color: #f4f4f4;
    padding: 15px;
    border-left: 4px solid #0073e6;
    margin: 20px 0;
    border-radius: 8px;
    transition: box-shadow 0.3s ease;
}

.text-box:hover {
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
}

.carousel {
    position: relative;
    width: 100%;
    max-width: 600px;
    margin: 0 auto;
    overflow: hidden;
    border-radius: 10px;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
}

.carousel-images {
    display: flex;
    transition: transform 0.5s ease;
}

.carousel-images img {
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.carousel img {
    width: 100%;
    flex-shrink: 0;
}

.carousel-buttons {
    position: absolute;
    top: 50%;
    width: 100%;
    display: flex;
    justify-content: space-between;
    transform: translateY(-50%);
}

.carousel-buttons button {
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    border: none;
    padding: 10px;
    cursor: pointer;
    border-radius: 50%;
    transition: background-color 0.3s ease;
}

.carousel-buttons button:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

.testimonials {
    padding: 40px 20px;
    background-color: #f4f4f4;
    text-align: center;
}

.testimonial {
    font-style: italic;
    margin: 20px 0;
    transition: transform 0.3s ease;
}

.testimonial:hover {
    transform: scale(1.05);
}

.testimonial span {
    display: block;
    margin-top: 10px;
    font-weight: bold;
    color: #0073e6;
}

.socials {
    display: flex;
    justify-content: center;
    gap: 15px;
    margin-top: 20px;
}

.socials a {
    display: inline-flex;
    align-items: center;
    text-decoration: none;
    font-size: 1rem;
    color: #333;
    border: 1px solid #ccc;
    padding: 10px 15px;
    border-radius: 5px;
    transition: background-color 0.3s ease, transform 0.3s ease;
}

.socials a:hover {
    background-color: #0073e6;
    color: white;
    transform: translateY(-3px);
}

.diplomas {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
}

.diploma-container {
    width: 300px;
    height: 400px;
    display: inline-block;
    margin: 10px;
    overflow: hidden;
}
.diploma-image {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border: 1px solid #ddd;
    border-radius: 30px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    transition: transform 0.3s ease;
}

.cases {
    background-color: #f9f9f9;
    padding: 40px 20px;
    border-radius: 10px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    
}

.cases h2 {
    font-family: 'Raleway', sans-serif;
    font-size: 28px;
    color: #333;
    text-align: center;
    margin-bottom: 20px;
}

.cases .text-box {
    padding: 20px;
    background-color: #fff;
    border-radius: 5px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
    font-family: 'Raleway', sans-serif;
    font-size: 16px;
    color: #666;
    line-height: 1.6;
    margin-bottom: 20px;
    transition: transform 0.3s ease;
}


.cases .text-box:hover {
    transform: translateY(-10px);
}

.cases .text-box:nth-child(odd) {
    margin-left: 0;
    margin-right: auto;
    max-width: 60%;
}

.cases .text-box:nth-child(even) {
    margin-left: auto;
    margin-right: 0;
    max-width: 60%;
}

.cases .text-box p {
    margin: 0;
}


.pricing-section {
    font-family: 'Raleway', sans-serif;
    text-align: center;
    position: relative;
}

.free-consultation {
    font-size: 12em; 
    font-weight: bold;
    color: #f8f8f8; 
    -webkit-text-stroke: 5px black; 
    text-stroke: 5px black; 
    margin: 20px 0; 
    position: relative;
    z-index: 1;
    transition: transform 0.3s ease, margin 0.3s ease;
}

.top-box, .bottom-box {
    transition: transform 0.3s ease, margin 0.3s ease;
}

.free-consultation:hover {
    transform: scale(1.1);
}

.free-consultation:hover ~ .top-box {
    transform: translateY(-15px);
}

.free-consultation:hover ~ .bottom-box {
    transform: translateY(15px);
}

@media (min-width: 1024px) {
    /*.container {
        flex-direction: row;
        align-items: flex-start;
    }
    */
    .obomne {
        display: flex;
    }
}
<!DOCTYPE html>
<html lang="ru">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Юрист</title>
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link href="https://fonts.googleapis.com/css2?family=Raleway:wght@400;700&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="style.css">
</head>
<body>
    <header class="header">
        <div class="container">
            <div class="header-inner">
                <h1>Юрист //////</h1>
                <p>20 лет опыта юридической практики. Бесплатные консультации.</p>
                <div class="header-contact">
                    <a  class="phone">+7 xxx xxx xx xx</a>
                    <a class="email">рыба@mail.ru</a>
                </div>
                
            </div>
        </div>
    </header>

    <nav class="nav">
        <div class="container">
            <ul>
                
                <li><a href="#about">Обо мне</a></li>
                <li><a href="#services">Услуги</a></li>
                <li><a href="#prices">Цены</a></li>
                <li><a href="#cases">Кейсы</a></li>
                <li><a href="#diplomas">Дипломы</a></li>
                <li><a href="#socials">Контакты</a></li>

            </ul>
        </div>
    </nav>
    
    <main>


        <section id="about" class="about">
            <div class="container">
                
                <h2>Обо мне</h2>
                
                <div class="obomne">
                    <img src="1.jpg" alt="Фото" style="width: 450px; height: auto; border-radius: 10px; box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);">
                    <div class="highlight-box">
                        Я юрист //////././////////
                    </div>
                </div>
            </div>
        </section>
        

        <section id="services" class="services" style = "font-weight: bold;">
            <div class="container">
                <br><br><br><br><br>
                <h2>Мои услуги</h2>

                <div class="highlight-box">
                    Я предоставляю <span style="text-decoration: underline;">БЕСПЛАТНЫЕ юридические консультации</span>, чтобы помочь вам в решении ваших правовых вопросов!
                </div>

                <div class="text-box">
                    Составление исков, претензий, договоров
                </div>
                <div class="text-box">
                    Представительство в суде
                </div>
                <div class="text-box">
                    Помощь при семейных, трудовых, жилищных спорах
                </div>
                <div class="text-box">
                    Представление интересов в государственных и иных органах
                </div>

                <div class="carousel">
                    <div class="carousel-images">
                        <img src="2.jpg">
                        <img src="2.png">
                        <img src="5.png">
                    </div>
                    <div class="carousel-buttons">
                        <button id="prev">&#10094;</button>
                        <button id="next">&#10095;</button>
                    </div>
                </div>
            </div>
        </section>

        
        <section id="prices" class="pricing-section">
            <br><br><br><br><br><br><br><br><br><br>
            <div class="highlight-box top-box">
              <h2>Цены</h2><br>
              <h3>Консультация:</h3>
            </div>
          
            <p class="free-consultation">БЕСПЛАТНО</p>
          
            <div class="highlight-box bottom-box">
              Составление документов: от 1000 ₽<br>
              Представительство в суде: от 5000 ₽
            </div>
            <p>Окончательная сумма может быть изменена по соглашению сторон.</p>
        </section>
          
          

        <section id="cases" class="cases">
            <div class="container">
                <br><br><br><br><br>
                <h2>Кейсы</h2>
                <div class="highlight-box">
                    <p>Стаж более 20 лет. /</p>

                </div>
                <div class="text-box">
                    <p><b>Обратилась девушка – сирота.</b> С супругом взяли в ИПОТЕКУ квартиру. //////</h2>
                </div>
                <div class="text-box">
                    <p><b>Банкротства</b> – популярные дела у юристов и много кто обращается за банкротством. //////</h2>
                </div>
                <div class="text-box">
                    <p><b>Споры по детям</b> – тяжелая процедура. ///////</h2>
                </div>
                <div class="text-box">
                    <p><b>Был у прадедушки дом.</b> С советского времени. //////</h2>
                </div>
            </div>
        </section>
        

        <section id="diplomas">
            <br><br><br><br><br><br><br><br><br>
            <h2>Дипломы и награды</h2>
            <div class ="diplomas">
                <div class="diploma-container">
                    <img class="diploma-image" src="d1.png" alt="Диплом юриста">
                </div>
                <div class="diploma-container">
                    <img class="diploma-image" src="d2.jpg" alt="Награда за юридические достижения">
                </div>
                <div class="diploma-container">
                    <img class="diploma-image" src="d3.jpg" alt="Сертификат о повышении квалификации">
                </div>
            </div>
            <div class="container">
                <div class="socials">
                    <a href="">Моё&nbsp;<strong>ПОЛНОЕ</strong>&nbsp;портфолио</a>
                </div>
            </div>
        </section>
        <br><br>

        <section id="socials" class="socials">
            <div class="container">
                <h2>Я в соцсетях</h2>
                <div class="socials">
                    <a href="" target="_blank">ВКонтакте</a>
                    <a href="" target="_blank">Telegram</a>
                    <a href="" target="_blank">WhatsApp</a>
                </div>
                <h3>Телефон: <a href="tel:+79131745819">+7 xxx xxxxx</a></h3>
            </div>
        </section>
    </main>

    <footer class="footer">
        <div class="container">
            <p>&copy; 2024 </p>
        </div>
    </footer>

    <script>

        document.querySelectorAll('.diploma-container').forEach(function(container) {
            container.addEventListener('click', function() {
                const src = this.querySelector('.diploma-image').src;
                const viewer = document.createElement('div');
                viewer.style.position = 'fixed';
                viewer.style.top = 0;
                viewer.style.left = 0;
                viewer.style.width = '100%';
                viewer.style.height = '100%';
                viewer.style.backgroundColor = 'rgba(0, 0, 0, 0.8)';
                viewer.style.display = 'flex';
                viewer.style.justifyContent = 'center';
                viewer.style.alignItems = 'center';
                viewer.style.zIndex = 1000;
                viewer.innerHTML = `<img src="${src}" style="max-width: 90%; max-height: 90%;">`;
                viewer.addEventListener('click', function() {
                    document.body.removeChild(viewer);
                });
                document.body.appendChild(viewer);
            });
        });

        document.querySelectorAll('.nav ul li a').forEach(link => {
            link.addEventListener('click', function(e) {
                e.preventDefault();
                const target = document.querySelector(this.getAttribute('href'));
                target.scrollIntoView({ behavior: 'smooth' });
            });
        });

        // Highlight active section link on scroll
        window.addEventListener('scroll', () => {
            const sections = document.querySelectorAll('section');
            const navLinks = document.querySelectorAll('.nav ul li a');
            let currentSection = '';

            sections.forEach(section => {
                const sectionTop = section.offsetTop - 100;
                if (pageYOffset >= sectionTop) {
                    currentSection = section.getAttribute('id');
                }
            });

            navLinks.forEach(link => {
                link.classList.remove('active');
                if (link.getAttribute('href').includes(currentSection)) {
                    link.classList.add('active');
                }
            });
        });

        // Add animation on scroll
        const observer = new IntersectionObserver(entries => {
            entries.forEach(entry => {
                if (entry.isIntersecting) {
                    entry.target.classList.add('visible');
                }
            });
        }, { threshold: 0.2 });

        document.querySelectorAll('section').forEach(section => {
            observer.observe(section);
        });

        // Carousel functionality
        const carouselImages = document.querySelector('.carousel-images');
        const images = document.querySelectorAll('.carousel img');
        const totalImages = images.length;
        let currentIndex = 0;

        document.getElementById('prev').addEventListener('click', () => {
            currentIndex = (currentIndex === 0) ? totalImages - 1 : currentIndex - 1;
            carouselImages.style.transform = `translateX(-${currentIndex * 100}%)`;
        });

        document.getElementById('next').addEventListener('click', () => {
            currentIndex = (currentIndex === totalImages - 1) ? 0 : currentIndex + 1;
            carouselImages.style.transform = `translateX(-${currentIndex * 100}%)`;
        });
    </script>
</body>
</html>


Ответы (1 шт):

Автор решения: Nhm1Off

попробуй использовать display: inline-flex; и min-width: 100%;

→ Ссылка