css背景图片,登录框固定不了

html-css014

css背景图片,登录框固定不了,第1张

新建一个html文件,命名为test.html,用于讲解css怎么让背景图片固定不动。

1、在test.html文件中,创建多个p标签,让页面产生滚动条。

2、在css样式中,使用background-image属性设置页面的背景图片为2.jpg,将background-repeat属性设置为no-repeat,让背景图片不重复显示。

3、在css样式中,再将background-attachment属性设置为fixed,实现当页面滚动时,背景图片在页面中固定不动。

4、在浏览器打开test.html文件,向下滚动页面,查看结果。

<div class="box" style="width:200pxoverflow:hiddenline-height:24pxfont-size:12pxtext-align:centerclear:both">

<input type="text" style="width:120pxheight:24pxborder:1px solid #ccccccfloat:leftmargin:4px 0" value="USER ID"/>

<!--type是设置input的类型,text,是单行文本,button是按钮,style,是设置input的属性依次为:宽度,高度,描边(线宽,模式,颜色),浮动(左边),跟周边距离(上下4px,左右0),框里默认字符-->

<input type="button" style="width:60pxheight:50pxmargin:4pxfloat:rightdisplay:inline" value="login" />

<input type="text" style="width:120pxheight:24pxborder:1px solid #ccccccfloat:left" value="PASSWORD" />

</div>

用dreamweaver建一个HTML文本,然后复制这段,到<body></body>里,这么详细,你不能不给我分!!