我需要在页面两侧添加两条黑线,但有一部分被切断并且没有到达页脚
max-width: 85,25em;
margin: 0 auto;
padding: 1.25em;
flex-wrap: wrap;
justify-content: center;
display: flex;
height: 0;
align-items: center;
margin: 0 20px;
}
::before,
::after {
content: '';
position: absolute;
top: 0;
bottom: 0;
width: 100px; /* Ancho de las líneas negras */
background-color: black;
z-index: 1; /* Coloca las líneas por encima del contenido */
}
::before {
left: 0;
}
::after {
right: 0;
}
看起来您没有在 css 中提到 html 选择器。您需要将您编写的样式应用到 html 元素,如下所示:
.element {
position: relative;
max-width: 85.25em;
margin: 0 auto;
padding: 1.25em;
display: flex;
flex-wrap: wrap;
justify-content: center;
align-items: center;
min-height: 100vh;
}
.element::before,
.element::after {
content: '';
position: absolute;
top: 0;
bottom: 0;
width: 100px;
background-color: black;
z-index: 1;
}
.element::before {
left: 0;
}
.element::after {
right: 0;
}
您可以将这些样式添加到您的 html 中,如下所示:
<div class="element">
。