css中的div宽度 [英] div width in css

查看:10
本文介绍了css中的div宽度的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在网页上有一个 div,它基本上充当面板容器.我想要:

i have a div on a web page that basically acts as a panel container. i want it to:

  1. 最小宽度为 1000 像素;所以不管div里面的内容有多小,它至少会让面板保持1000px的宽度:
  2. 就最大宽度而言,它应该与其中的内容一样大.因此,如果一个人有一个 24 英寸的显示器并且他们想要最大化浏览器,它应该继续增长,直到里面的内容没有任何滚动条然后停止.
  3. 需要在所有浏览器中工作.

我将如何在 css 中做到这一点?

how would i do this in css?

推荐答案

假设这个项目是一个块元素(即显示:块"),它应该自动缩放到与其包含元素一样宽(在这种情况下浏览器窗口).

Assuming this item is a block element (i.e. "display: block"), it should scale automatically as wide as its containing element (in this case the browser window).

在 CSS 中,只需指定min-width: 1000px".这将适用于 IE8+ 和所有现代浏览器.

In CSS, just specify "min-width: 1000px." This will work in IE8+ and all modern browsers.

这篇关于css中的div宽度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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