position

居中的最佳方法 在垂直和水平页面上? [重复]

大憨熊 提交于 2020-01-28 05:23:45
这个问题已经在这里有了答案 : 如何水平和垂直居中放置元素 (19个答案) 11个月前 关闭。 在页面上垂直和水平居中放置 <div> 元素的最佳方法? 我知道 margin-left: auto; margin-right: auto; margin-left: auto; margin-right: auto; 会以水平为中心,但是垂直进行的最佳方法是什么? #1楼 这个解决方案对我有用 .middleDiv{ position : absolute; height : 90%; bottom: 5%; } (或高度:70%/底部:15% 高度:40%/底部:30%...) #2楼 最好,最灵活的方式 我 在dabblet.com上的演示 该演示的主要技巧是元素的正常流动是从上到下,因此 margin-top: auto 设置为零。 但是,绝对放置的元素在分配自由空间方面的作用相同,并且类似地可以在指定的 top 和 bottom 垂直居中(在IE7中不起作用)。 此技巧适用于任何大小的 div 。 div { width: 100px; height: 100px; background-color: red; position: absolute; top:0; bottom: 0; left: 0; right: 0; margin: auto; } <div></div

Python爬虫(一)

こ雲淡風輕ζ 提交于 2020-01-28 04:26:28
本教程基于Python3.6,Mac OS系统,Pycharm编辑器 使用urllib库可以获取网页,示例代码如下 1 from urllib import request 2 3 #要爬取的网页,这里以百度为例 4 url = 'http://www.baidu.com/' 5 6 #构建请求对象Request 7 res = request.Request(url) 8 9 #发起请求,得到请求结果,命名为response 10 response = request.urlopen(res) 11 12 #读取结果,命名为html 13 html = response.read() 14 15 #打印查看结果 16 print(html) 可以看到打印的结果为 /Library/Frameworks/Python.framework/Versions/3.6/bin/python3.6 /Users/pn/Desktop/Python/blog/demo.py b'<!DOCTYPE html>\n<!--STATUS OK-->\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n

Unity2018的HDRPStandard材质分析笔记(二)

旧巷老猫 提交于 2020-01-28 02:35:20
Frag void Frag(PackedVaryingsToPS packedInput, #ifdef OUTPUT_SPLIT_LIGHTING out float4 outColor : SV_Target0, // outSpecularLighting out float4 outDiffuseLighting : SV_Target1, OUTPUT_SSSBUFFER(outSSSBuffer) #else out float4 outColor : SV_Target0 #endif #ifdef _DEPTHOFFSET_ON , out float outputDepth : SV_Depth #endif ) { FragInputs input = UnpackVaryingsMeshToFragInputs(packedInput.vmesh); uint2 tileIndex = uint2(input.positionSS.xy) / GetTileSize(); #if defined(UNITY_SINGLE_PASS_STEREO) tileIndex.x -= unity_StereoEyeIndex * _NumTileClusteredX; #endif // input.positionSS is SV_Position

css鼠标移入底部边框展开效果

被刻印的时光 ゝ 提交于 2020-01-28 00:21:15
经常看到这种效果,就研究了下。 <a href='' class='tag'>测试一下吧</a> .tag { text-decoration:none; position:relative; padding:10px } .tag:after{ content:''; position:absolute } .tag:after { border-bottom:2px solid #333; left:51%; right:51%; bottom:0px; transition: all .2s; } .tag:hover:after { left:0%; right:0% } 来源: CSDN 作者: 陈星波 链接: https://blog.csdn.net/c2635222586/article/details/87025765

堆叠上下文

牧云@^-^@ 提交于 2020-01-27 20:42:45
  本文试着先解释一下堆叠顺序是什么,在引入堆叠上下文。   MDN上这样解释堆叠上下文:   层叠上下文是HTML元素的三维概念,这些HTML元素在一条假想的相对于面向(电脑屏幕的)视窗或者网页的用户的z轴上延伸,HTML元素依据其自身属性按照优先级顺序占用层叠上下文的空间。   平时我们浏览网页时,可以理解为从网页的正视图方向观看,理解堆叠上下文时,我们试着从侧视图的方向理解。方方老师说CSS的一个很重要的学习方法就是实验法,本文试着将所有的结论都有实验的依据。(祝福我吧,希望可以不看回放。。。)   首先,我们先思考一下,border和background的先后关系: <body> <div class="demo"></div> </body> <style> .demo{ width: 100px; height: 100px; border: 10px solid rgba(255,0,0,0.5); background: green; } </style>   效果图:      可见,background < border;接着,我们在父元素里加一个div,观察一下border和子元素div的关系:    <body> <div class="parent"> <div class="child"></div> </div> </body> <style>

原型模式

醉酒当歌 提交于 2020-01-27 19:01:53
找工作难呐   大家好,我原本是神剑山庄的铸剑师,名叫小赵,本来干的好好的,后来一时兴起,睡了三少爷的小姨子,与其一直提心吊胆,干脆来个逃之夭夭。   但是,我也要吃饭的呀,工作也得找,神剑山庄去不得,还有断剑山庄、藏剑山庄、荡剑山庄、等等等等大型企业,说不定这次跳槽,能跳出个飞黄腾达!   为了提高我投简历的准确性,我觉得简历要写的多样化,不能全写一模一样,比如说我的期望薪资不能写成一样,因为我希望能够根据目标企业的情况来投递合适薪资的简历,这样中标概率大一点。   这是我的简历类: public class Resume { private String name; private String position; private int salary; public String getName() { return name; } public void setName(String name) { this.name = name; } public String getPosition() { return position; } public void setPosition(String position) { this.position = position; } public int getSalary() { return salary; } public

DIV常用属性大全

余生颓废 提交于 2020-01-27 17:36:42
一、属性列表 color : #999999 文字颜色 font-family : 宋体 文字字型 font-size : 10pt 文字大小 font-style:itelic 文字斜体育 font-variant:small-caps 小字体 letter-spacing : 1pt 文字间距 line-height : 200% 设定行高 font-weight:bold 文字粗体 vertical-align:sub 下标字 vertical-align:super 上标字 text-decoration:line-through 加?h除线 text-decoration:overline 加顶线 text-decoration:underline 加底线 text-decoration:none ?h除连接底线 text-transform : capitalize 首字大写 text-transform : uppercase 英文大写 text-transform : lowercase 英文写 text-align:right 文字*右对齐 text-align:left 文字*左对齐 text-align:center 文字置中对齐 这些是一些简单的文字效果,可以应用到css的页面中。  背景 background-color:black 背景颜色

WebGL渲染2D图形

拥有回忆 提交于 2020-01-27 13:59:48
WebGL是通过OpenGL ES在HTML的<canvas></canvas>上渲染图形的。 ... <canvas id="main-canvas"></canvas> ... let gl = document.getElementById("main-canvas").getContext("webgl"); if (!gl) { alert("无法使用WebGL!"); } else { console.log(gl); } 这样,就获取到了在canvas上渲染webgl的上下文。 接下来,在canvas上一切的渲染操作,最终都是要依靠这个gl变量来控制的。 不过在此之前,需要作一下前期准备。 着色器准备 首先要准备一下着色器的源码,着色器(shader)是由GLSL(OpenGL Shadering Language,一种类C++语言)编写的计算机程序。着色器是成对出现的,分别是顶点着色器: <script type="notjs" id="vertex-shader-2d"> attribute vec4 a_position; void main() { gl_Position = a_position; } </script> 和片段着色器: <script type="notjs" id="fragment-shader-2d"> precision

OpenGL----FPS摄像机类实现之美

好久不见. 提交于 2020-01-27 03:58:31
#ifndef CAMERA_H #define CAMERA_H #include <glad/glad.h> #include <glm/glm.hpp> #include <glm/gtc/matrix_transform.hpp> #include <vector> // Defines several possible options for camera movement. Used as abstraction to stay away from window-system specific input methods enum Camera_Movement { FORWARD, BACKWARD, LEFT, RIGHT }; // Default camera values const float YAW = -90.0f; const float PITCH = 0.0f; const float SPEED = 2.5f; const float SENSITIVITY = 0.1f; const float ZOOM = 45.0f; // An abstract camera class that processes input and calculates the corresponding Euler Angles, Vectors and

50道 CSS 经典题

我是研究僧i 提交于 2020-01-27 02:54:36
1 介绍一下标准的CSS的盒子模型?与低版本IE的盒子模型有什么不同的? 标准盒子模型:宽度=内容的宽度(content)+ border + padding + margin 低版本IE盒子模型:宽度=内容宽度(content+border+padding)+ margin 2 box-sizing属性? 用来控制元素的盒子模型的解析模式,默认为content-box context-box:W3C的标准盒子模型,设置元素的 height/width 属性指的是content部分的高/宽 border-box:IE传统盒子模型。设置元素的height/width属性指的是border + padding + content部分的高/宽 3 CSS选择器有哪些?哪些属性可以继承? CSS选择符:id选择器(#myid)、类选择器(.myclassname)、标签选择器(div, h1, p)、相邻选择器(h1 + p)、子选择器(ul > li)、后代选择器(li a)、通配符选择器(*)、属性选择器(a[rel=”external”])、伪类选择器(a:hover, li:nth-child) 可继承的属性:font-size, font-family, color 不可继承的样式:border, padding, margin, width, height 优先级(就近原则):