sách gpt4 ăn đã đi

html - header 内容包装到#header 但#header 显示为空

In lại 作者:搜寻专家 更新时间:2023-10-31 22:40:48 32 4
mua khóa gpt4 giày nike

我的 header 内容被包装到#header 中,但是当我设置边框显示结构时,它显示我的#header 的内容出现在#header 本身之后。可能是什么问题?这是我的代码:

#header {
border:1px solid red;
max-height:150px;
}

#logo {
border:1px solid red;
display:inline-block;
float:left;
}

#navbar {
border:1px solid red;
display:inline-block;
float:right;
}

#logo_img {
max-height:50px;
}

.nav li {
display:inline;
}

câu trả lời hay nhất

如果您使用 float ,您可以对标题使用 clearfix 以使其扩展到内容大小,如下所示:

#header {
border:1px solid red;
max-height:150px;
}

#logo {
border:1px solid red;
display:inline-block;
float:left;
}

#navbar {
border:1px solid red;
display:inline-block;
float:right;
}

#logo_img {
max-height:50px;
}

.nav li {
display:inline;
}

.clearfix:after {
visibility: hidden;
hiển thị: khối;
font-size: 0;
content: " ";
clear: both;
height: 0;
}

.clearfix {
hiển thị: khối nội tuyến;
}

* html .clearfix {
height: 1%;
}

.clearfix {
hiển thị: khối;
}

biên tập:

当您包含 Bootstrap 样式表时,菜单会变大,因此您可能希望从 #header 中删除 max-height 以便它能够扩展到全高。可能您对菜单有其他一些用途,因此它不会一直扩展/打开。

关于html - header 内容包装到#header 但#header 显示为空,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37132928/

32 4 0
Chứng chỉ ICP Bắc Kinh số 000000
Hợp tác quảng cáo: 1813099741@qq.com 6ren.com
Xem sitemap của VNExpress