300字范文,内容丰富有趣,生活中的好帮手!
300字范文 > css总结 -使用display:inline-block 出现元素高度错位

css总结 -使用display:inline-block 出现元素高度错位

时间:2024-03-09 10:06:05

相关推荐

css总结 -使用display:inline-block 出现元素高度错位

在进行页面布局时发现一个问题,两个相同高度的元素显示高度不一致,发生错位。

<style>.left{display:inline-block;height:110px;width:110px;}.right{display:inline-block;height:110px;width:110px;}</style><div class='container'><div class="left"></div><div class="right"></div></div>

调整方法,就是为他们指定基准线

<style>.left{display:inline-block;height:110px;width:110px;vertical-align:top}.right{display:inline-block;height:110px;width:110px;vertical-align:top}</style><div class='container'><div class="left"></div><div class="right"></div></div>

其实为其中一项指定基准线即可,

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。