猿问

来自http://www.imooc.com/video/775,为什么我写出来跟老师的不一样?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<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">

body{ margin:0; padding:0; font-size:30px}

div{ text-align:center; font-weight:bold}

.main,.footer{ width:960px; margin:0 auto}

.head{ width:100%; height:100px; background:#ccc}

.main{ height:600px; background:#FCC;margin 0 auto}

.sub_l{width:200px;height:600px;background:#63F;float:left;margin-top:-600px}

.left{width:190px;height:600px;background:#F99;float:left;margin-top:-600px}

.sub_r{width:200px;height:600px;background:#FC3;float:right;margin-top:-600px}

.right{width:190px;height:600px;background:#6F9;float:right;margin-top:-600px}

.footer{ height:50px; background:#9CF;margin 0 auto}

</style>

</head>


<body>

<div class="head">head</div>

<div class="main">main</div>

<div class="sub_l">sub_l</div>

<div class="sub_r">sub_r</div>

<div class="left">left</div>

<div class="right">right</div>

<div class="footer">footer</div>

</body>

</html>

哪里出错了?

妈妈你听
浏览 1178回答 1
1回答

依韵S1

这个我建议你再去多看几遍视频的,就算要左右浮动,外面也要用一个div包起来的
随时随地看视频慕课网APP
我要回答