CSS 3列浮点(2个固定,1个动态) [英] CSS 3 Column float (2 fixed, 1 dynamic)

查看:103
本文介绍了CSS 3列浮点(2个固定,1个动态)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在设计一个由3个部分组成的头。

I'm designing a header which is made of 3 parts.

页面必须是流动的: min-width:940px; max-width:1200px;

标题的前两部分将固定大小:

The first two parts of the header will be fixed size:

   left       middle        right
<---------><---------><----------------->
   134px      183px       (Fill the remaining space)

我希望正确的部分更改根据页面的大小,我将粘贴到目前为止,但我的问题是使它填补了差距完整。

I'd like the right part to change depending on the size of the page, I'll paste what I have so far but my problem is making it fill the gap completetly.

HTML:

<div class="main">

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

CSS:

    .main{
        margin:auto;
        min-width:940px;
        max-width:1200px;
        background-color:#000;
    }

    .left{
    float: left;
    width: 134px;
    height: 191px;
    background-color:#0000ff;
    }
    .middle{
    float: left;
    width: 183px;
    height: 191px;
    background-color:#ffff00;
    }

    .right{
    float: left;
    width: 60%;
    height: 191px;
    background-color:#ff0000;
    }


推荐答案

>

Try this:

<html>
<head>
<title>Three columns</title>
<style type="text/css">
div.main { background-color: #000; }
div.left { float: left; width: 134px; height: 191px; background-color:#0000ff; }
div.middle { float: left; width: 183px; height: 191px; background-color:#ffff00; }
div.right { height: 191px; background-color: #ff0000; margin-left: 317px; }
</style>
</head>
<body>
<div class="main">
<div class="left"></div>
<div class="middle"></div>
<div class="right"></div>
</div>
</body>
</html>

这篇关于CSS 3列浮点(2个固定,1个动态)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆