Heim  >  Artikel  >  Web-Frontend  >  新手求教:我的floatDIV空白了_html/css_WEB-ITnose

新手求教:我的floatDIV空白了_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-23 08:47:341367Durchsuche

刚学习HTML+CSS,请各位多多指教。
看视频教程的时候,学习做一个田字格,代码如下:



    


    
1

    
2

    
3

    
4

    

不过变成了这样:


百度了一下,没看出错在哪里。请各位大大指点指点


回复讨论(解决方案)

background-color


        .one{
        width:100px;
        height:100px;
        background:#cc0000;
        float:left;
    }
        .two{
        width:100px;
        height:100px;
        background: #0066ff;
        float:left;
    }   
        .three{
        width:100px;
        height:100px;
        background:#66ff00;
        float:left;
        clear:left;
    }   
        .four{
        width:100px;
        height:100px;
        background:#ffff00;
        float:left;
    }
分号没加

而且你的background:#000000 后面缺少;号

补充一下,我将float:left跟clear:left两个指令去掉之后,就变成这样:


反正就是一定不能加float:left,一加上颜色就不见了

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn