如何使一个div填充剩余的水平空间? [英] How to make a div to fill a remaining horizontal space?

查看:147
本文介绍了如何使一个div填充剩余的水平空间?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有2个div:一个在我的页面的左侧,一个在右侧。左侧的那个具有固定的宽度,我希望右侧的一个填充剩余的空间。

I have 2 divs: one in the left side and one in the right side of my page. The one in the left side has fixed width and I want the one of the right side to fill the remaining space.

右侧的一个是导航,

我的CSS:

#search {
    width: 160px;
    height: 25px;
    float: left;
    background-color: #FFF;
}

#navigation {
    width: 780
    float: left; 
    /*background-color: url('../images/transparent.png') ;*/
    background-color: #A53030;
}

我的Html:

<div id="search">

</div>
<?php include("navigation.html"); ?>
<div id="left-column">

提前感谢!

推荐答案

这似乎完成了你要做的事。

This seems to accomplish what you're going for.

<html>

<head>
	<title>This is My Page's Title</title>
	<style type="text/css">
		#left {
			float:left;
			width:180px;
			background-color:#ff0000;
		}
		#right {
			width: 100%;
			background-color:#00FF00;
		}
	</style>
</head>

<body>
	<div>
		<div id="left">
			left
		</div>
		<div id="right">
			right
		</div>
	</div>
</body>

</html>

这篇关于如何使一个div填充剩余的水平空间?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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