html - 为什么我给div设置display:inline然后设置height还是有效呢
本文介绍了html - 为什么我给div设置display:inline然后设置height还是有效呢的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
问 题
不是说display:inline设置height和width没有用吗,不理解
<style type="text/css">
.navbar {
background-color: #35322b;
position: fixed;
display: inline;
height: 200px;
left: 0;
width: 100%;
}
</style>
<div class="navbar"></div>
解决方案
因为设置了 position: fixed
根据规范,在设置了position: fixed
或position: absolute
的元素上,实际的display
类型由下表确定:
因此 div 实际应用样式为 display: block
这篇关于html - 为什么我给div设置display:inline然后设置height还是有效呢的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文