简体   繁体   English

显示:内联删除块

[英]Display: inline removes blocks

I've been learning HTML and CSS for around 2 months, but apparently I'm still a neophyte. 我已经学习HTML和CSS大约两个月了,但是显然我还是个新手。 I'm trying to create somewhat of a header nav bar here, but when ever I set the property display:inline , poof ! 我正在尝试在此处创建标题导航栏,但是每当我设置属性display:inline ,poof时, They disappear. 他们消失了。 I'm pretty sure this problem is rudimentary but any input you have helps. 我很确定这个问题是基本问题,但是您提供的任何帮助都可以。

div { 
    border-radius: 5px 55px 5px 55px;
}

#Header {
    height: 50px; 
    width: 200px; 
    background-color: #f38630; 
    margin-bottom: 10px; 
    margin-top: 10px; 
    display: inline;
}

.Left {
    height: 300px; 
    width: 150px; 
    background-color: #A7DBD8; 
    float: left; 
    margin-bottom: 10px;
}

.Right {
    height: 300px; 
    width: 450px; 
    background-color: #E0E4CC;
    float: right; 
    margin-bottom: 10px;
}

#Footer {
    height: 50px;
    background-color: #69D2E7;
    clear: both;
}

In nutshell, you should not be using display: inline for anything that is not intended to be a displayed inside a block of text. 简而言之,您不应将display: inline用于任何不希望在文本块内显示的内容。

This is a good site for learning layout basics: http://learnlayout.com 这是学习布局基础的好网站: http : //learnlayout.com

If you really want to learn this stuff though, this is the best place I know: https://dash.generalassemb.ly :) 如果您真的想学习这些东西,那么这是我所知道的最好的地方: https : //dash.generalassemb.ly :)

Hope that helps. 希望能有所帮助。 Let me know if you don't feel I've answered your question. 如果您觉得我没有回答您的问题,请告诉我。

我不会对div使用display:inline -block,而是将其应用于列表项或标签。

It has to do with the generation of containing blocks, whether or not your element is inline or block, also the type of positioning. 它与包含块的生成有关,无论您的元素是内联还是块,还与定位的类型有关。 An inline element without content will not show. 没有内容的内联元素将不会显示。 Here is the de facto resource for your problem: de facto web standards 这是您的问题的实际资源: 实际Web标准

visual rendering 视觉渲染

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM