为了账号安全,请及时绑定邮箱和手机立即绑定

为什么我的黄色的 上不去

<html>

<head>

<meta content="utf-8">

<title>混合布局</title>

<style type="text/css">

body{

    margin:0;

padding:0;

}

.top{

    height:100px;

background:blue

}

.head{

    height:100px;

width:800px;

background:#ff0;

margin:0 auto;

}

.main{

    width:800px;

height:600px;

background:#ccc;

margin:0 auto

}

.left{

      width:200px;

  height:600px;

  background:red;

  float:lefthttps://img1.sycdn.imooc.com//5cef447b0001119e12010795.jpg

}

.right{

       width:600px;

   height:600px;

   background:#FCC;

   float:right

}

.sub_l{

      width:400px;

  height:600px;

  background:#0f0;

  float:left

}

.sub_r{

      widht:200px;

  height:600px;

  background:#369;

  float:right;

}

.foot{

    width:800px;

height:100px;

background:#900;

margin:0 auto;

}

</style>

</head>

<body>

<div class="top"></div>

   <div class="head">

   </div>

<div class="main">

   <div class="left">lol

  </div>

   <div=class="right">CF

      <div class="sub_l">COC

  </div>

      <div class="sub_r">GRT

  </div>

   </div>

</div>   

<div class="foot">foot</div>

</body>

</html>


正在回答

3 回答

<div class="top"></div>

   <div class="head">

   </div>

你的代码写错了。块元素会另起一行,你的写到top父元素里面去,正确写法如下:

<div class="top">

           <div class-"head"></div>

</div>

0 回复 有任何疑惑可以回复我~

你的代码

<div=class="right">CF

      <div class="sub_l">COC

  </div>

第一行div和class中间多了个=

0 回复 有任何疑惑可以回复我~

不明白你的问题是啥意思哦,看样式你的设置的head就是宽度800居中显示的,独占一行

0 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
如何用CSS进行网页布局
  • 参与学习       209673    人
  • 解答问题       1153    个

用最简洁的案例教你布局的那些知识,这是前端工程师基本技能

进入课程

为什么我的黄色的 上不去

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信