CSS让背景在不同分辨率下自动伸缩的代码?怎样写

html-css011

CSS让背景在不同分辨率下自动伸缩的代码?怎样写,第1张

这样的话你的背景图片必须是能左右、上下拼合的图片。你就可以做到了,否则会出现层次不齐的现象! Body {background:url(图片路径) center center repeat} 可以简单解释一下,两个center指定了背景绝对居中对齐, repeat指定了背景可以向周围无限拉伸! 如果你想垂直拉伸则是repeat-y 横向拉伸是repeat-x 如果你是做层要满足任何比例,那则定义层的宽度为100%即可

div 要设高度

DIV 不像表格那样 同一行按高度最大的 单元格 为标准

你给左右两边的DIV 设个高度 你就会看出问题所在了。

<div style=" border-top:1px #ccc solidborder-bottom:1px #ccc solidtext-align:centeroverflow:hidden">

<div style="float:leftwidth:100pxborder-left:1px #ccc solidheight:100%padding-bottom: 1000pxmargin-bottom: -1000px">dasdbebebebe</br>dsadasdasd</div>

<div style="float:leftwidth:300pxborder-left:1px #ccc solidheight:100%">bebebebe</br>dsadasdasdbebebebe</br>dsadasdasdbebebebe</br>dsadasdasd</div>

<div style="float:leftwidth:100pxborder-left:1px #ccc solidheight:100%padding-bottom: 1000pxmargin-bottom: -1000px">dasdbebebebe</br>dsadasdasd</div>

<div style="clear:both"></div>

你试试 应该是可以的 刚写的 可读性不是很好