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

html-css017

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文件,向下滚动页面,查看结果。

CSS只是用来写样式的。要写输入框就用HTML的<input>标签。例如:<input type="text" name="username" /><input type="password" name="password">

用div+css制作一个登录页面,首先需要做的就是将这个登录界面的布局给构想好,然后在使用div去布局出来,一般都要结合表单,因为是需要和数据库结合的,至于的具体的界面,看下代码:

<html>

<head>

<meta charset="UTF-8">

<title>淘宝登录</title>

<link rel="stylesheet" type="text/css" href="../static/css/index.css" />

<script type="text/javascript">

<{if $message !=''}>

alert("<{$message}>")

<{/if}>

</script>

</head>

<body>

<div id="logo">

<div class="logotop">

<div class="yanz">

<h2>登录</h2>

<form action="logo.php" method="post">

<span style="display:blockheight:27pxwidth:27pxbackground-image:url(../static/images/logozh.jpg)float:left"></span>

<input type="text" name="uname" style="height:26px"/><br/>

<span style="display:blockheight:27pxwidth:27pxbackground-image:url(../static/images/logomm.jpg)float:left"></span>

<input type="password" name="pwd" style="height:26px"/>

<p><a href="">忘记登录密码?</a></p>

<input type="submit" value="" style="width:254pxheight:37pxbackground-image:url(../static/images/logodl.jpg)cursor: pointer"/>

</form>

</div>

</div>

</div>

</body>

</html>

这个代码有些图片的地址,需要根据要求去改,这些是我自己写的,然后就是传输的文件,action那,接受的文件也是需要定义的。