一、主要内容

继续CSS

二、CSS

第一个: postion
网页有一类就是返回顶部,一直在右下角,还有打开一个网页顶部有个菜单,滚动滑轮,顶部永远在上面。
position: 
fiexd  ==>固定在页面的某个位置,他可以结合上下左右来控制他的位置。
 
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<div onclick="GoTop();" style="width: 50px;height: 50px;color: white;
position: fixed;
bottom: 20px;
right:20px;
" >返回顶部</div>
<div style="height: 5000px;" >dfsdfsd</div>
<script>
function GoTop(){
document.body.scrollTop = ;
}
</script>
</body>
</html>
效果如下:
 
 
 
 
 
实现顶部固定在上面
 
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
.pg-header{
height: 48px; color: #dddddd;
position: fixed;
top:;
right:;
left:;
}
.pg-body{ height:5000px;
margin-top:50px;
}
</style>
</head>
<body>
<div class="pg-header" >头部</div>
<div class="pg-body" >内容</div>
</body>
</html>
 
position:  relative+ absolution
放在父类标签的某个位置。
<body>
<div style="position: relative;width: 500px;height: 200px;border: 1px solid red; margin: 0 auto;">
<div style="position: absolute;left: 0;bottom: 0; width: 50px;height: 50px;"></div>
</div>
<div style="position: relative;width: 500px;height: 200px;border: 1px solid red; margin: 0 auto;">
<div style="position: absolute;right: 0;bottom: 0; width: 50px;height: 50px;"></div>
</div>
<div style="position: relative;width: 500px;height: 200px;border: 1px solid red; margin: 0 auto;">
<div style="position: absolute;right: 0;top: 0; width: 50px;height: 50px;"></div>
</div>
</body>
样式格式:
 
记住2点即可:
1、fixed 定位位置
2、relative + absolute 相对父类定义位置。
 
 
写一个三层
透明度:opcity:0.5
层级顺序,越大就在上面
<body>
<div style="z-index: 10; position: fixed;top: 50%;left: 50%;margin-left:-250px;margin-top:-200px;height: 400px;width: 500px;"></div>
<div style="z-index: 9; position: fixed;
top: ;
left: ;
right: ;
bottom: ;
opacity: 0.5;
"></div>
<div style="height: 5000px;
asdfsdf
</div>
</body>
  • 如果我想隐藏2个页面,可以加入一下面语句
style="display: none;
 
我定义一个边框,超过我就隐藏或者出现滚动条 overflow  : hidden或者auto
隐藏
<div style="height: 200px;width: 300px;overflow: hidden;">
<img src="data:images/01.jpg" alt="">
</div>
滚动条
<div style="height: 200px;width: 300px;overflow: auto;">
<img src="data:images/01.jpg" alt="">
</div>
 
放在鼠标上出现hover
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
<style>
.pg-header{
position: fixed;
right:;
left:;
top:;
height: 48px; line-height:48px;
}
.pg-boder{
margin-top: 50px; }
.w{
width:980px;
margin: auto;
}
.pg-header .menu{
display: inline-block;
padding: 10px;
}
.pg-header .menu:hover{ }
</style>
</head>
<body>
<div class="pg-header">
<div class="w">
<a class="logo">LOGO</a>
<a class="menu">全部</a>
<a class="menu">42区</a>
<a class="menu">段子</a>
<a class="menu"></a>
</div>
</div>
<div class="pg-boder">
<div class="w">a</div>
</div>
</body>
</html>
显示效果:
 
写一个登录
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<div style="height: 35px;width: 400px;position: relative;">
<input type="text" style="height: 35px;width: 370px;padding-right: 30px;">
<span style="position: absolute;right: 6px;top:10px;background-image: url(1.jpg);height: 16px;width: 16px;display: inline-block;"></span>
</div>
</body>
</html>
 
写了一个首页top
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Document</title>
<style>
.pg-header{ height:38px;
line-height:38px;
}
.main{
float: right;
color: black;
font-size:15px;
display: inline-block;
padding: 20px;
}
.main span:hover{ }
.p1{
float: left;
border: 1px solid #dddddd;
margin: 10px;
padding:10px;
position: relative;
}
.hot{
position: absolute;
right:;
top:;
}
.pc{
border:1px solid red;
margin: 60px;
} .menu{
display: inline-block;
padding: 10px;
}
</style>
</head>
<body style="margin: 0 auto">
<div class="pg-header">
<div style="width: 980px;margin: 0 auto;">
<div style="float: left; font-size: 15px;">*收藏本站</div>
<div class="main">
<span class="menu">登录</span>
<span class="menu">注册</span>
<span class="menu">我的订单</span>
<span class="menu">我的收藏</span>
<span class="menu">VIP会员俱乐部</span>
<span class="menu">客户服务</span>
<span class="menu">关注</span>
<span class="menu">手机版</span>
</div>
</div> </div>
</body>
</html>
 
 
 
 
 

一个初学者的辛酸路程-前端cs的更多相关文章

  1. 一个初学者的辛酸路程-前端js

    内容回顾: 1.CSS的基本概念: 层叠样式表. 2.CSS的三种书写方式 ① 行内样式 <div style="color: red;">sdfdsf</div ...

  2. 一个初学者的辛酸路程-python操作SQLAlchemy-13

    前言 其实一开始写blog,我是拒绝的,但是,没办法,没有任何理由抗拒.今天呢,要说的就是如何使用Python来操作数据库. SQLAlchemy SQLAlchemy是Python编程语言下的一款O ...

  3. 一个初学者的辛酸路程-FTP-9

    前言 今天,我要描述一个FTP的故事 主要内容 嗯,今天主要以阶梯性的形式来做一个FTP项目. 第一步: 我要实现这么一个功能,一个FTP客户端,1个FTP服务端,2端建立连接以后可以进行通讯. 服务 ...

  4. 一个初学者的辛酸路程-socket编程-8

    前言: 你会发现会网络是多么幸福的事情 主要内容: socket 概念: socket本质上就是2台网络互通的电脑之间,架设一个通道,两台电脑通过这个通道来实现数据的互相传递.我们知道网络通信都是基于 ...

  5. 一个初学者的辛酸路程-Python基础-3

    前言 不要整天沉迷于学习-. 字典 一.我想跟你聊聊字典 1.为何要有字典? 大家有没有想过为什么要有字典?有列表不就可以了吗? 也许大家会这么认为,我给大家举个例子,大家就明白了. 比如说,我通讯录 ...

  6. 一个初学者的辛酸路程-了解Python-2

    前言 blog花了一上午写的,结果笔记本关机了,没有保存,找不到了,找不到了啊,所以说,你看的每一篇blog可能都是我写了2次以上的--.哎!! 代码改变世界,继续......... Python基础 ...

  7. 一个初学者的辛酸路程-初识Python-1

    前言 很喜欢的一句话,与诸位共勉. 人的一切痛苦,本质上都是对自己无能的愤怒----王小波. 初识Python 一.它的爸爸是谁 首先,我们需要认识下面这位人物. 他是Python的创始人,吉多范罗苏 ...

  8. 一个初学者的辛酸路程-依旧Django

    回顾: 1.Django的请求声明周期?   请求过来,先到URL,URL这里写了一大堆路由关系映射,如果匹配成功,执行对应的函数,或者执行类里面对应的方法,FBV和CBV,本质上返回的内容都是字符串 ...

  9. 一个初学者的辛酸路程-继续Django

    问题1:HTTP请求过来会先到Django的那个地方? 先到urls.py  ,里面写的是对应关系,1个URL对应1个函数名. 如果发URL请求过来,到达这里,然后帮你去执行指定的函数,函数要做哪些事 ...

随机推荐

  1. 指定类型的成员XX”不支持实体LINQ。只有初始化,成员单位,和实体导航性能的支持。

    The specified type member 'DeleteFlag' is not supported in LINQ to Entities. Only initializers, enti ...

  2. AJAX(二):HTTP头部信息

    每个http请求和响应都会带有相应都头部信息,其中有的对开发人员有用,有的页没有什么用默认情况下,发送xhr请求的同时,还有发送下列头部信息 Accept:浏览器能够处理的内容类型 Accept-Ch ...

  3. xshell 连接虚拟机过程

    (1)Ctrl+Shift+T 打开终端 terminal (2)ifconfig得到ip网络地址 (3)ssh安装已经打开ssh服务 (4)安装openssh-server sudo apt ins ...

  4. Firefox 修改User Agent

    Android 版 Mozilla/5.0 (Linux; U; Android 2.2; en-us; Nexus One Build/FRF91) AppleWebKit/533.1 (KHTML ...

  5. FTP服务安装及使用

    准备工作:一台服务器.我这里使用的是阿里云的ECS. 环境使用的是:windows 2008 r2 用途:FTP是用来进行文件传输的,我们可以把这个目录在IIS上配置成发布的网站,我们在本地只用把我们 ...

  6. js 金额小写转换为大写

    <script> jQuery(document).ready(function () { //当金额文本框失去焦点时,自动将数字转化为大写填充到 大写的文本框中 $("#Amo ...

  7. MySQL备份工具percona-xtrabackup安装

    1.安装xtrabackup的yum源 rpm -ivh https://www.percona.com/redir/downloads/percona-release/redhat/latest/p ...

  8. Mysql: pt-table-checksum 和 pt-table-sync 检查主从一致性,实验过程

    一.安装 percona 包 1.安装仓库的包 https://www.percona.com/doc/percona-repo-config/yum-repo.html sudo yum insta ...

  9. thinkphp5,单图,多图,上传

    /** * 上传单图 */ function upload($path, $filename) { $file = request()->file($filename); $info = $fi ...

  10. ethereum(以太坊)(九)--global(全局函数)

    pragma solidity ^0.4.0; contract modifierTest{ bytes32 public blockhash; address public coinbase; ui ...