Задать вопрос
  • Как будет правильно создать блоки в виде треугольников в шапке?

    Archerwell
    @Archerwell
    Resist the temptation to always talkabout yourself
    <!DOCTYPE html>
    <html lang="ru">
    <head>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <title>Треугольники в шапке</title>
        <style>
            body {
                margin: 0;
                font-family: Arial, sans-serif;
            }
    
            header {
                position: relative;
                height: 200px;
                background-color: #4CAF50;
                color: white;
                text-align: center;
                line-height: 200px;
                font-size: 24px;
                overflow: hidden;
            }
    
            /* Левый верхний треугольник */
            header::before {
                content: '';
                position: absolute;
                top: 0;
                left: 0;
                width: 0;
                height: 0;
                border-style: solid;
                border-width: 100px 100px 0 0;
                border-color: #333 transparent transparent transparent;
            }
    
            /* Правый нижний треугольник */
            header::after {
                content: '';
                position: absolute;
                bottom: 0;
                right: 0;
                width: 0;
                height: 0;
                border-style: solid;
                border-width: 0 0 100px 100px;
                border-color: transparent transparent #333 transparent;
            }
        </style>
    </head>
    <body>
        <header>
            Шапка сайта
        </header>
    </body>
    </html>
    Ответ написан
    1 комментарий