css - 创建一个大小相对于固定宽度 div 和包含区域的 div?

标签 css html

我有一个包含 N% 宽的 div (contentBody)。在那个 div 中,我有另外两个 div,contentLeft 和 contentRight。

contentLeft 始终为 205 像素。我希望 contentRight 自动填充 contentBody 中的剩余空间。我怎样才能做到这一点?

#div contentLeft{
  width:205px;
  float:left;
}

#div contentRight{
  width:<**100% - 205px**>;
  float:left;
}

编辑:抱歉,我的意思是写“N%”而不是 100%,这需要适用于任何百分比或大小的包含区域。

最佳答案

应该做到以下几点:

#contentBody{
  width:N%
}
#div contentLeft{
  width:205px;
  float:left;
}

#div contentRight{
  margin-left:205px;
}

关于css - 创建一个大小相对于固定宽度 div 和包含区域的 div?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1027017/

相关文章:

javascript - 将 td 包装在 div 中并在 JQuery 对话框中打开该 div

javascript - 防止用户在 javascript 中离开我的页面

html - 使用css将文本定位在一个圆圈中

javascript - 在 JS/Jquery 中使用 .find() 和 .each()

javascript - twitter bootstrap btn-group 来驱动标签内容

css - :hover does not seem to be working on custom buttons

html - 如何在用户名和密码表单之间留空

Css 剪辑图像然后调整大小

php - 使用与操作不同的重定向位置提交表单

html - Bootstrap : Text overflows out of div