移动端设置, 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> 在我的项目中 ...
随机推荐
- VS Code设置中文插件
Vscode是一款开源的跨平台编辑器.默认情况下,vscode使用的语言为英文(en) 1)打开vscode工具: 2)使用快捷键组合[Ctrl+Shift+p],在搜索框中输入“configure ...
- 「THUWC 2017」在美妙的数学王国中畅游
这个题目很明显在暗示你要用泰勒展开. 直接套上去泰勒展开的式子,精度的话保留12项左右即可. 分别维护每一项的和,可能比较难写吧. 然后强行套一个LCT就没了.
- Centos 6.5 搭建阿里云yum源
Linux系统下yum源配置(Centos 6) 1.备份 mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo ...
- Tree总结
树结构问题因为容易写出解法,因此经常出现在面试题中 1. 树的种类 1) Tree 2) Binary Trees 3) Binary Search Trees(BST) : used to sort ...
- 第二阶段——个人工作总结DAY04
1.昨天做了什么:实现所有需要跳转活动的点击事件. 2.今天打算做什么:打算把值能够传递过去. 3.遇到的困难:无
- shiro中JSP标签
Shiro提供了JSTL标签用于在JSP/GSP页面进行权限控制,如根据登录用户显示相应的页面按钮. 导入标签库 <%@taglib prefix="shiro" uri=& ...
- bat安装python的msi包
#把python-2.7.3.amd64.msi和这个脚本放在同一个目录下 @ECHO OFF ::定于初始变量SET python_home=C:\Python27SET python_exe= ...
- leetcode-algorithms-18 4Sum
leetcode-algorithms-18 4Sum Given an array nums of n integers and an integer target, are there eleme ...
- python 常用代码
获取标签名 h1 class 是h1usersoup.find(name="h1", attrs={"class":"h1user"});获 ...
- @RequestParam的使用
来源:http://825635381.iteye.com/blog/2196911 @RequestParam: 一. 基本使用,获取提交的参数 后端代码: @RequestMapping(&quo ...