移动端设置, 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> 在我的项目中 ...
随机推荐
- P3721 [AH2017/HNOI2017]单旋
题目:https://www.luogu.org/problemnew/show/P3721 手玩一下即可AC此题. 结论:插入x后,x要么会成为x的前驱的右儿子,要么成为x的后继的左儿子,这取决于它 ...
- 6.5 开始进入设计 … Transition to Design
开始进入设计 … Transition to Design 从需求分析到设计 逻辑架构与子系统 Logical Architecture and sub-system 5.1 向设计过程切换 ...
- python基础之生成器,生成器函数,列表推导式
内容梗概: 1. 生成器和生成器函数. 2. 列表推导式. 1.生成器函数1.1 生成器函数. 就是把return换成yield def gen(): print("爽歪歪") y ...
- DFS CCPC2017 南宁I题
The designers have come up with a new simple game called “Rake It In”. Two players, Alice and Bob, i ...
- JavaScript工具函数集
/** * [getQueryStringArgs 用以解析查询字符串] * @return {[Object]} [一个包含所有参数的对象] */ function getQueryStringAr ...
- leetcode-algorithms-20 Valid Parentheses
leetcode-algorithms-20 Valid Parentheses Given a string containing just the characters '(', ')', '{' ...
- 安卓——BroadcastReceiver
package com.example.administrator.myapplication_reciver; import android.content.BroadcastReceiver; i ...
- 安卓——Activity生命周期、
在xml 设计页面添加标签 <?xml version="1.0" encoding="utf-8"?> <LinearLayout xmln ...
- PAT 1031 Hello World for U
1031 Hello World for U (20 分) Given any string of N (≥) characters, you are asked to form the char ...
- [CodeForces - 447E] E - DZY Loves Fibonacci Numbers
E DZY Loves Fibonacci Numbers In mathematical terms, the sequence Fn of Fibonacci numbers is define ...