Почему применяется форматирование к блоку вне другого?

/*@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@700;800&display=swap');*/
html {
    box-sizing: border-box;
}

*,
*::before,
*::after {
    box-sizing: inherit;
}

body {
    background-color: #A462F0;
    font-family: "Manrope";
    font-style: normal;
    font-size: 16px;
    line-height: 1.2;
    font-weight: normal;
    color: #FFFFFF;

}

.wrapper {
    max-width: 1440px;
    margin: 0 auto;
    margin-left: 165px;
    margin-right: 165px;

}

.header_wrapper {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    padding-top: 24px;
}


.header_list {
    display: flex;
    flex-wrap: wrap;
}

.header_item {
    margin-right: 32px;
}

.header_item:last-child {
    margin-right: 0;
}

.header_link {
    font-size: 14px;
    line-height: 20px;
    color: #FFFFFF;
    text-decoration: none;

}

.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
}

.header_link:hover,
.header_link:focus,
.header_link:active {
    opacity: 0.75;

}


.header_logo {
    margin-left: 200px;
    margin-right: 200px;
}

.header_icons {
    margin-right: 30px;
}


.header_logo-link:hover {
    opacity: 0.75;
}


.intro {
    min-height: 100vh;
    padding-top: 284px;
}


.intro_title {
    width: 540px;
    height: 196px;
    left: 0px;
    top: 0px;
    font-weight: 800;
    font-size: 72px;
    line-height: 98px;
    color: white;
    max-width: 540px;
    margin-bottom: 16px;
}


.sub_title {
    font-size: 18px;
    line-height: 32px;
    max-width: 540px;
    font-weight: 700;
    color:white;
}
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Manrope:wght@700;800&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="css/reset.css">
    <link rel="stylesheet" href="css/main.css">
    <title>Landify</title>
</head>

<body>
    <header class="header">
        <div class="wrapper">
            <div class="header_wrapper">
                <nav class="header_nav">
                    <ul class="header_list">
                        <li class="header_item">
                            <a href="#!" class="header_link">About</a>
                        </li>
                        <li class="header_item">
                            <a href="#!" class="header_link">Pricing</a>
                        </li>
                        <li class="header_item">
                            <a href="#!" class="header_link">Contact</a>
                        </li>
                    </ul>
                </nav>
                <div class="header_logo">
                    <a href="#" class="header_logo-link"><img src="img/svg/Dark.svg" alt="Landify page" class="header_logo-pic"></a>
                </div>
                <nav class="social_link">
                    <ul class="header_list">
                        <li class="header_icons"><a href="#!"><img src="img/svg/Instagram.svg"</a> </li>
                        <li class="header_icons"><a href="#!"><img src="img/svg/Dribbble.svg"</a> </li>
                        <li class="header_icons"><a href="#!"><img src="img/svg/Twitter.svg"</a>
                        </li>
                        <li class="header_icons"><a href="#!"><img src="img/svg/Youtube.svg"</a>
                        </li>
                    </ul>
                </nav>
            </div>
        </div>
    </header> 
    
    <main class="main">
        <section class="intro">
            <div class="wrapper">
                <h1 class="intro_title">
                Landing page UI kit
                </h1>
                <p class="sub_title">
                    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc odio in et, lectus sit lorem id integer.
                </p>
            </div>
        </section>
    </main>
</body>
</html>

У меня получается следующий результат:введите сюда описание изображения

Соответственно, тэг h1 форматируется как тэг a и становится ссылкой, помимо прочего, что становится ссылкой, по какой-то причине занимает огромную площадь и получается так, что даже при наведении в пустое пространство, курсор меняется, как будто бы наведен на ссылку. Не могу разобраться и понять почему так происходит.


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

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

Это происходит, потому что в <ul class="header_list"> у вас незакрытые теги img, поэтому движок браузера пытается закрыть теги самостоятельно.

/*@import url('https://fonts.googleapis.com/css2?family=Manrope:wght@700;800&display=swap');*/
html {
    box-sizing: border-box;
}

*,
*::before,
*::after {
    box-sizing: inherit;
}

body {
    background-color: #A462F0;
    font-family: "Manrope";
    font-style: normal;
    font-size: 16px;
    line-height: 1.2;
    font-weight: normal;
    color: #FFFFFF;

}

.wrapper {
    max-width: 1440px;
    margin: 0 auto;
    margin-left: 165px;
    margin-right: 165px;

}

.header_wrapper {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    justify-content: space-between;
    padding-top: 24px;
}


.header_list {
    display: flex;
    flex-wrap: wrap;
}

.header_item {
    margin-right: 32px;
}

.header_item:last-child {
    margin-right: 0;
}

.header_link {
    font-size: 14px;
    line-height: 20px;
    color: #FFFFFF;
    text-decoration: none;

}

.header {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
}

.header_link:hover,
.header_link:focus,
.header_link:active {
    opacity: 0.75;

}


.header_logo {
    margin-left: 200px;
    margin-right: 200px;
}

.header_icons {
    margin-right: 30px;
}


.header_logo-link:hover {
    opacity: 0.75;
}


.intro {
    min-height: 100vh;
    padding-top: 284px;
}


.intro_title {
    width: 540px;
    height: 196px;
    left: 0px;
    top: 0px;
    font-weight: 800;
    font-size: 72px;
    line-height: 98px;
    color: white;
    max-width: 540px;
    margin-bottom: 16px;
}


.sub_title {
    font-size: 18px;
    line-height: 32px;
    max-width: 540px;
    font-weight: 700;
    color:white;
}
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="preconnect" href="https://fonts.googleapis.com">
    <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
    <link href="https://fonts.googleapis.com/css2?family=Manrope:wght@700;800&display=swap" rel="stylesheet">
    <link rel="stylesheet" href="css/reset.css">
    <link rel="stylesheet" href="css/main.css">
    <title>Landify</title>
</head>

<body>
    <header class="header">
        <div class="wrapper">
            <div class="header_wrapper">
                <nav class="header_nav">
                    <ul class="header_list">
                        <li class="header_item">
                            <a href="#!" class="header_link">About</a>
                        </li>
                        <li class="header_item">
                            <a href="#!" class="header_link">Pricing</a>
                        </li>
                        <li class="header_item">
                            <a href="#!" class="header_link">Contact</a>
                        </li>
                    </ul>
                </nav>
                <div class="header_logo">
                    <a href="#" class="header_logo-link"><img src="img/svg/Dark.svg" alt="Landify page" class="header_logo-pic"></a>
                </div>
                <nav class="social_link">
                    <ul class="header_list">
                        <li class="header_icons"><a href="#!"><img src="img/svg/Instagram.svg"></a> </li>
                        <li class="header_icons"><a href="#!"><img src="img/svg/Dribbble.svg"></a> </li>
                        <li class="header_icons"><a href="#!"><img src="img/svg/Twitter.svg"></a>
                        </li>
                        <li class="header_icons"><a href="#!"><img src="img/svg/Youtube.svg"></a>
                        </li>
                    </ul>
                </nav>
            </div>
        </div>
    </header> 
    
    <main class="main">
        <section class="intro">
            <div class="wrapper">
                <h1 class="intro_title">
                Landing page UI kit
                </h1>
                <p class="sub_title">
                    Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc odio in et, lectus sit lorem id integer.
                </p>
            </div>
        </section>
    </main>
</body>
</html>

→ Ссылка