移动端设置, mobile , 一张图片作为背景 ,平铺 ,自动拉伸 , 图片 铺满视界 ,窗口. background-image , background-size, background-repeat
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的更多相关文章
- 移动端(视口(meta),像素比,二倍图(图片,背景图,精灵图),css初始化(normalize.css),特殊样式,常见屏幕尺寸)
		
1. 视口:(布局视口(layout viewport),视觉视口(visual viewport),理想视口(ideal viewport)) meta 视口标签 <meta name = ...
 - C#word(2007)操作类--新建文档、添加页眉页脚、设置格式、添加文本和超链接、添加图片、表格处理、文档格式转化
		
转:http://www.cnblogs.com/lantionzy/archive/2009/10/23/1588511.html 1.新建Word文档 #region 新建Word文档/// &l ...
 - Java将数据按列写入Excel并设置格式(字体、背景色、自动列宽、对齐方式等)
		
本文使用jxl.jar工具类库将数据按列写入Excel并设置格式(字体.背景色.自动列宽.对齐方式等). /** * 按列写入Excel并设置格式 * * @param outputUrl * 输出路 ...
 - 【小梅哥SOPC学习笔记】设置Eclipse在编译(build)前自动保存源代码文件
		
设置Eclipse在编译(build)前自动保存源代码文件 Eclipse 常用设置之让Eclipse在编译(build)前自动保存源代码文件 一.让Eclipse在编译(build)前自动保存源代码 ...
 - 安卓ImageView.src设置图片拉伸、填满控件的方法
		
代码改变世界 安卓ImageView.src设置图片拉伸.填满控件的方法 需要给你的ImageView布局加上Android:adjustViewBounds="true"
 - YTU 2598: 编程题B-小平智斗自动售货机
		
2598: 编程题B-小平智斗自动售货机 时间限制: 1 Sec 内存限制: 128 MB 提交: 268 解决: 69 题目描述 LYH自动售货机在销售商品时,具有自动找钱功能.但是找零的最小单 ...
 - table   设置自动宽度后   td 的固定宽度  在 谷歌浏览器自动拉伸
		
table 设置自动宽度后 td 的固定宽度 在 谷歌浏览器自动拉伸 解决方案 <table style="table-layout:fixed;">
 - 如何从一张图片中裁剪一部分距形图片另存为文件(使用Canvas.CopyRect)
		
如何从一张图片中裁剪一部分距形图片另存为文件? Delphi / Windows SDK/APIhttp://www.delphi2007.net/DelphiMultimedia/html/delp ...
 - 移动端设置-----rem
		
对于现在不同尺寸的移动端屏幕,如果设置px来说实在有点影响用户体验,在小屏幕上太大,大屏幕上太小,不能实现响应式,所以就引进了rem的概念. rem是相对于根元素<html> 在我的项目中 ...
 
随机推荐
- 小程序动态添加class及调接口传递多个参数
			
1.动态添加class <view class="step2 {{indication == 2 ?'on':''}}"> <view class='tc lef ...
 - Mysql中从一张表中的数据添加到另一张表
			
A为原表 B为要加入的表$sql="insert into B select * from A where id=$id";
 - 报错 hint: Updates were rejected because the remote contains work that you do  解决方法
			
1. git pull origin master --allow-unrelated-histories 2.git pull origin master 3.git init 4.git remo ...
 - 远程桌面连接报错:出现身份验证错误,要求函数不受支持,由于CredSSP加密Oracle修正。
			
远程桌面连接错误: 解决方法: 1.在运行中输入gpedit.msc,启动本地组策略编辑器. 2.定位到计算机—管理模板—系统—凭据分配 3.点凭据分配—加密Oracle修正. 4.加密Oracle修 ...
 - 『TensorFlow』第十一弹_队列&多线程&TFRecod文件_我辈当高歌
			
TF数据读取队列机制详解 一.TFR文件多线程队列读写操作 TFRecod文件写入操作 import tensorflow as tf def _int64_feature(value): # val ...
 - 『cs231n』通过代码理解风格迁移
			
『cs231n』卷积神经网络的可视化应用 文件目录 vgg16.py import os import numpy as np import tensorflow as tf from downloa ...
 - 第一阶段——站立会议总结DAY10
			
1.昨天做了什么:找到了一些模板,把自己的修改了修改,排版了一下. 2.今天准备做什么:做最后的整理,添加一些小图标一些的.还要把按钮的字体换成红色. 3.遇到的困难:一般定义的文字和下拉菜单的文字的 ...
 - InnoDB存储引擎介绍-(5) Innodb逻辑存储结构
			
如果创建表时没有显示的定义主键,mysql会按如下方式创建主键: 首先判断表中是否有非空的唯一索引,如果有,则该列为主键. 如果不符合上述条件,存储引擎会自动创建一个6字节大小的指针. 当表中有多个非 ...
 - python中RabbitMQ的使用(路由键)
			
1.简介 当我们希望每个接收端接收各自希望的消息时,我们可以使用路由键,此时交换机的类型为direct. 2.工作原理 每个接收端的消息队列在绑定交换机的时候,可以设定相应的路由键. 发送端通过交换机 ...
 - input text  在苹果微信浏览器中有上上阴影
			
box-shadow:0px 0px 0px rgba(0,0,0,0); -webkit-appearance:none;