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

为什么会这样?

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

</head>

<style type="text/css">

body{margin:0;padding:0;}

.left{height:100px;width:20%;background-color:#ccc;float:left;}

.right{height:100px;width:80%;background-color:#0FF;float:right;}

</style>

<body>

<div class="main">

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

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

</div>

</body>

</html>

http://img1.sycdn.imooc.com//5a4f9ef200015d6107820594.jpg

正在回答

2 回答

float:left;

冒号被你永成中文符了大哥

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

width 加起来别等于100,不然会挤出来

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

举报

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

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

进入课程

为什么会这样?

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