Home >Web Front-end >HTML Tutorial >新手求教:我的floatDIV空白了_html/css_WEB-ITnose

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

WBOY
WBOYOriginal
2016-06-23 08:47:341422browse

刚学习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,一加上颜色就不见了

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn