Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在做一个移动网络应用程序,我想在屏幕顶部留空 50dp 的高度,有什么想法吗?
我试过制作一个高度为 50dp 的 div 但这不起作用
<div style="display:inline-block; height:20px width: 70px">My Text Here</div>
有几种解决方案,具体取决于您要实现的目标。此外,我会考虑将您的样式从与 HTML 内联到外部样式表,因为这遵循最佳实践,并有助于您的样式更加模块化/可重用。
利润:.inner-element { margin-top: 50px; }
.inner-element { margin-top: 50px; }
定位.inner-element { position: relative; top: 50px; }
.inner-element { position: relative; top: 50px; }
填充.container-element { padding-top: 50px; }
.container-element { padding-top: 50px; }