css中的position: fixed属性是否使该元素成为inline-block元素?


header{
display : flex;
justify-content: space-between;
position : fixed;
}

在赋值fixed to position属性后,header元素只占用所需的空间。我的HTML网站

我期望header元素占用整个宽度

在定义位置时,您需要使用:

header{
display: flex;
right: 0;
left: 0;
justify-content: space-between;
position: fixed;
}

或者设置width:100%;width:100vw;

最新更新