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. PHP工厂模式的使用场景,使用方法

    所谓工厂模式和生产有关.生产什么呢?生产出来的是一个实例对象.通过什么设备生产?通过一个工厂类生产simpleFactoty.怎么生产呢?工厂类调用自身静态方法来生产对象实例static functi ...

  2. CentOS7.3将网卡命名方式设置为传统方式

    CentOS7.3将网卡命名方式设置为传统方式 生产环境可能拥有不同系列的操作系统,比如,既有CentOS6系列,也有CentOS7系列的系统,而CentOS6和CentOS7在网卡命名方面有着较大区 ...

  3. Kay and Snowflake CodeForces - 685B (重心, 好题)

    大意:给定有根树, 求每个子树的重心 我太菜了啊, 只能想到暴力树剖, 然而这就是个B题, 感觉树剖+线段树二分还是挺难写的..... 看了题解发现重心一定在重儿子与根的树链上, 重心最多上跳n-1次 ...

  4. leetcode-algorithms-19 Remove Nth Node From End of List

    leetcode-algorithms-19 Remove Nth Node From End of List Given a linked list, remove the n-th node fr ...

  5. ThinkPHP3的使用

    1. 初始目录 7d 根目录 ├─Application 应用目录(空) ├─Public 资源文件目录 ├─ThinkPHP 框架目录 └─index.php 入口文件 2. 入口文件 // 应用入 ...

  6. Django之WSGI 和MVC/MTV

    一.什么是WSGI? WEB框架的本质是一个socket服务端接收用户请求,加工数据返回给客户端(Django),但是Django没有自带socket需要使用 别人的 socket配合Django才能 ...

  7. nginx配置location总结及rewrite规则写法(2)

    2. Rewrite规则 rewrite功能就是,使用nginx提供的全局变量或自己设置的变量,结合正则表达式和标志位实现url重写以及重定向.rewrite只能放在server{},location ...

  8. 在springboot中验证表单信息(六)

    构建工程 创建一个springboot工程,由于用到了 web .thymeleaf.validator.el,引入相应的起步依赖和依赖,代码清单如下: 1 2 3 4 5 6 7 8 9 10 11 ...

  9. eclipse安装scala环境

    1.安装eclipse插件,依次点击Help->Eclipse Marketplace 2.输入scala,点击go,进行搜索 3,出现了Scala IDE4.7X,点击右下方的Install进 ...

  10. Struts 2 初步入门(一)

    搭建Struts 2环境步骤 下载jar包----->创建web项目---->创建并完善相关配置文件---->创建action并测试启动 下载jar包访问网站:http://stru ...