CSS如何填充整个宽度? [英] CSS how to fill the entire width?

查看:216
本文介绍了CSS如何填充整个宽度?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经护目了,但仍然不知道该怎么做

i already goggle but still don't know what to do

我有3 div

<body>
    <div id="container">
        <div id="center"> <h1>center</h1> </div>
        <div id="right"> <h1>right</h1> </div>
    </div>
</body>

我尝试完成的内容


  • div id = center是自动填充宽度

  • div id = right在div的右侧位置id = center,width = 200px;

我尝试到目前为止

#center{
    background-color: green;
        float: left;
        overflow: auto;
}

#right{
    background-color: red;
        float: right;
        width: 200px;
}

如何使div id = center填充整个宽度与另一个div id = right)in the right position of it

How to make div id=center fill the entire width with another div (div id=right) in right position of it

jsfiddle

原谅我的英语

推荐答案

此处,并了解了一个新的/有用的

I got this from here and learnt a new/useful one.

以下解决方案不会影响您的dom进行更改。

The following solution will not affect your dom in making changes.

#center{
    background-color: green;
    float: left;
    width: -moz-calc(100% - 200px);
    width: -webkit-calc(100% - 200px);
    width: calc(100% - 200px);
}

DEMO

这篇关于CSS如何填充整个宽度?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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