css怎么设置2个div同行,第一个固定宽度,第二个占满剩余的部分

<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <style type="text/css">
        *{margin:0;padding:0;}
.wrap { width:1000px height:500px;margin:100px auto;border:1px solid;} .left {float:left;width:200px;background-color:#ff0;height:500px;} .right {background-color:#f00;height:500px;margin-left:200px;} </style> <title>My First Blog</title> </head> <body>
<div class="wrap">     <div class="left">left</div>   <div class="right">right</div> </div>
</body> </html>  
 <!-- 如果没有wrap包围的话,是可用的,但是加上wrap之后,右边就被挤下去20像素,刚才研究了一下也没研究出来,有时间在好好研究研究是哪里挤下去的 -->             
posted @ 2019-08-21 14:10  大尹  阅读(1439)  评论(0编辑  收藏  举报