1.  效果:

浏览器:

手机模拟:

2.代码:

 <!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>登陆</title>
<meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="css/reset.css">
<style type="text/css"> .all {
position: absolute;
top: 0px;
left: 0px;
bottom: 0px;
right: 0px;
background-image: url(image/login_bg.png);
background-size:100% 100%;
background-repeat: no-repeat;
} .username {
width: 66%;
height: 50px;
margin: 0px auto;
/*border: 1px solid red;*/ position: absolute;
left: 17%;
bottom: 270px; background-color: #DDDDDD; border-radius: 4px;
cursor: pointer;
} #username {
width: 100%;
height: 100%;
font-size: 16px;
opacity: 0;
} .password {
width: 66%;
height: 50px;
margin: 0px auto;
/*border: 1px solid red;*/ position: absolute;
left: 17%;
bottom: 200px; background-color: #DDDDDD; border-radius: 4px;
cursor: pointer;
} #password {
width: 100%;
height: 100%;
font-size: 16px;
opacity: 0;
} .loginButton {
width: 40%;
height: 50px;
margin: 0px auto;
/*border: 1px solid red;*/ position: absolute;
left: 30%;
bottom: 100px;
font-size: 16px;
text-align: center;
background-color: #F37000;
line-height: 50px;
color: #fff; border-radius: 4px;
cursor: pointer;
} </style>
</head>
<body>
<div class="all"> <div class="username">
<input type="text" name="" id="username" placeholder="用户名">
</div> <div class="password">
<input type="text" name="" id="password" placeholder="密码">
</div> <div class="loginButton" onclick="jump()">
登陆
</div> </div>
</body> <script type="text/javascript" src="js/jquery-3.1.1.js"></script> <script type="text/javascript"> $(function(){
$("#username, #password").focus(function(event) {
$(this).css('opacity', 1);
}).focusout(function(event) {
$(this).css('opacity', 0);
}); }); function jump(){
window.location.href = 'subject.html';
} </script>
</html>

关键代码:

         .all {
position: absolute;
top: 0px;
left: 0px;
bottom: 0px;
right: 0px;
background-image: url(image/login_bg.png);
background-size:100% 100%;
background-repeat: no-repeat;
}

移动端设置, mobile , 一张图片作为背景 ,平铺 ,自动拉伸 , 图片 铺满视界 ,窗口. background-image , background-size, background-repeat的更多相关文章

  1. 移动端(视口(meta),像素比,二倍图(图片,背景图,精灵图),css初始化(normalize.css),特殊样式,常见屏幕尺寸)

    1. 视口:(布局视口(layout viewport),视觉视口(visual viewport),理想视口(ideal viewport)) meta 视口标签 <meta  name = ...

  2. C#word(2007)操作类--新建文档、添加页眉页脚、设置格式、添加文本和超链接、添加图片、表格处理、文档格式转化

    转:http://www.cnblogs.com/lantionzy/archive/2009/10/23/1588511.html 1.新建Word文档 #region 新建Word文档/// &l ...

  3. Java将数据按列写入Excel并设置格式(字体、背景色、自动列宽、对齐方式等)

    本文使用jxl.jar工具类库将数据按列写入Excel并设置格式(字体.背景色.自动列宽.对齐方式等). /** * 按列写入Excel并设置格式 * * @param outputUrl * 输出路 ...

  4. 【小梅哥SOPC学习笔记】设置Eclipse在编译(build)前自动保存源代码文件

    设置Eclipse在编译(build)前自动保存源代码文件 Eclipse 常用设置之让Eclipse在编译(build)前自动保存源代码文件 一.让Eclipse在编译(build)前自动保存源代码 ...

  5. 安卓ImageView.src设置图片拉伸、填满控件的方法

    代码改变世界 安卓ImageView.src设置图片拉伸.填满控件的方法 需要给你的ImageView布局加上Android:adjustViewBounds="true"

  6. YTU 2598: 编程题B-小平智斗自动售货机

    2598: 编程题B-小平智斗自动售货机 时间限制: 1 Sec  内存限制: 128 MB 提交: 268  解决: 69 题目描述 LYH自动售货机在销售商品时,具有自动找钱功能.但是找零的最小单 ...

  7. table 设置自动宽度后 td 的固定宽度 在 谷歌浏览器自动拉伸

    table   设置自动宽度后   td 的固定宽度  在 谷歌浏览器自动拉伸 解决方案 <table style="table-layout:fixed;">

  8. 如何从一张图片中裁剪一部分距形图片另存为文件(使用Canvas.CopyRect)

    如何从一张图片中裁剪一部分距形图片另存为文件? Delphi / Windows SDK/APIhttp://www.delphi2007.net/DelphiMultimedia/html/delp ...

  9. 移动端设置-----rem

    对于现在不同尺寸的移动端屏幕,如果设置px来说实在有点影响用户体验,在小屏幕上太大,大屏幕上太小,不能实现响应式,所以就引进了rem的概念. rem是相对于根元素<html> 在我的项目中 ...

随机推荐

  1. Digital Deletions HDU - 1404

    Digital deletions is a two-player game. The rule of the game is as following. Begin by writing down ...

  2. layuitable设置数据表

    如图,要设置类似这样的格式 步骤如下: 1. 设置一个列表表格 2. 获取数据 table.render({ elem: '#pl-list' ,id: 'pl_table' ,height: 480 ...

  3. Codeforces Beta Round #64D - Professor's task

    题意:两种操作1.加点2.查询点是否在之前给定点的凸包内 题解:set维护动态凸包,分别维护上下凸壳,对y取反就行,判断点是否在凸壳内,把点加进去看要不要删除就好了 //#pragma GCC opt ...

  4. 第一阶段——站立会议总结DAY10

    1.昨天做了什么:找到了一些模板,把自己的修改了修改,排版了一下. 2.今天准备做什么:做最后的整理,添加一些小图标一些的.还要把按钮的字体换成红色. 3.遇到的困难:一般定义的文字和下拉菜单的文字的 ...

  5. Apache commons(Java常用工具包)简介

    Apache Commons是一个非常有用的工具包,解决各种实际的通用问题,下面是一个简述表,详细信息访问http://jakarta.apache.org/commons/index.html Be ...

  6. LVS-概念

    一.负载均衡LVS基本介绍 LB集群的架构和原理很简单,就是当用户的请求过来时,会直接分发到Director Server上,然后它把用户的请求根据设置好的调度算法,智能均衡地分发到后端真正服务器(r ...

  7. python_递归实现汉诺塔 (string类型的指针出错 未解决)

    在递归的时候,和数学的归纳法一致. void func( mode) { if(endCondition) { constExpression //基本项 } else { accumrateExpr ...

  8. 了解一下express中间件的意思以及next()

    app.use()就是通常所说的使用中间件 一个请求发送到服务器后,它的生命周期是 先收到request(请求),然后服务端处理,处理完了以后发送response(响应)回去,而这个服务端处理的过程就 ...

  9. Python装饰器--decorator

    装饰器 装饰器实质是一个函数,其作用就是在不改动其它函数代码的情况下,增加一些功能.如果我们需要打印函数调用前后日志,可以这么做 def log(func): print('%s is running ...

  10. [CodeForces - 614C] C - Peter and Snow Blower

    C - Peter and Snow Blower Peter got a new snow blower as a New Year present. Of course, Peter decide ...