右边的字离背景色的上边距那么大?

<html xmlns="http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>

    <title></title>

    <style type="text/css">

        h3{font-size:18px;}

        .box{width:300px;

            border-left:300px solid #0026ff;

             background:#808080

        }

        .left{margin-left:-300px;

             

             

        }

        

    </style>

</head>

<body>

<div class="box">

    <nav class="left">

        <h3>导航</h3>

    </nav>

    <section>

        <div class="module">模块</div>

        <div class="module">模块</div>

        <div class="module">模块</div>

        <div class="module">模块</div>

    </section>

   

    

</div>

    

</body>

</html>

http://img.mukewang.com/598e95cf0001fa0306520168.jpg

慕娘6074509
浏览 1593回答 3
3回答

卖火柴的小老鼠

你按f12打开调试工具,你会发现h3的宽度是在这个模块四个字上面的,所以这四个模块就在下面。看这张图

Mosaic被占用了

这是因为“导航”占据了一行,你在 .left{} 中设置添加右浮动:float:left;

慕的地8582982

NAUQKNTZSPCPGYJNNQTGNNDHHBBJCPEISBAVWFXMTZNXTCLLFZCDTQADJAAANRXQICYXPFFVYZYMETFSMAUKHRHEUJJZAGTXWGXULHNXHUEIELFIOLOZCPVLOLPYYPXDYXUBBYXXBHLBHCAWLYEEYXVGQTPLOBRCSYOFCNPZYYMOYBYBDMMCCGKVBYSPGJJAKGMFMTOLISVGUNJWWBRAVVVLXDHNMPJSUBJGZKBBHAANNEFVGRLXDHVMQIHIIRUAGKEMKDANTJCYIJTEGQHIRLFYSSQZKUCVFYOTRHQTTRHXRKPSZFIJQNQXYEZSRTMBHAPPIIIBEEQGGWLIMJLJBBSMFGPFTSEHZPXTLOYYRHRQDWMXDANDAXDWNYSCIVURYRUEFAAIOHHUBKNDUMIIYYBXQCPTTHBRUYRXTJSDTXGKAZCYCMUKNPCZIYSVOPZWWPPOAQJNEVOPCZZZWPZMTIXBUSVLEYIZREUURFOOEYUATTAUNBAREYYHHEIBVYCCCUDTXNJAKUNNXDHYRGNHRFFTSQJMYOHRSVYXKXDTDZZTTGIIBZLSLUFVSLAGMPTDTTUAJDGGFOBMQQZFZJUTTRAAQAFKKGCPIIZCFUSMUWGJMMDTWHLLNKTEECWBFVIKGDBDNRAWMVZVMPMCSUYNNWMJZVZCRORZPLHKOENPFHIRUXEIFVFVIKNCENRUXMPMQGJGISIYVEVRURIYPTCZCTBYUQNQSIFISMVLODNJMFPKBKEHRHLBDADQFIYUKFWYVYXNCAJSILSQMIDNQTPJZJMCRNCZCENXHWMFJTWZCEZCSCJTOECFMDTRHDTVYVQGPEIRUQTWLVEHXGCQFJXNEVYHEHDMPMJAQHQAKIYNLUXUXMHX
打开App,查看更多内容
随时随地看视频慕课网APP