position

CSS知识点总结[部分]

£可爱£侵袭症+ 提交于 2019-12-20 05:04:40
css是英文Cascading Style Sheets的缩写,称为层叠样式表,用于对页面进行美化。 存在方式有三种:元素内联、页面嵌入和外部引入,比较三种方式的优缺点。 注释为 /* 注释内容 */ CSS选择器 标签选择器 div{ background-color:red; } <div > </div> class选择器 .bd{ background-color:red; } <div class='bd'> </div> id选择器 #idselect{ background-color:red; } <div id='idselect' > </div> 关联选择器(层级选择器) #idselect p{ background-color:red; } <div id='idselect' > <p> </p> </div> 组合选择器(逗号分隔) input,div,p{ background-color:red; } <div>hello world</div> <input type="text"/> <input type="password"/> <p>hello world</p> 属性选择器 对选择到的标签再通过属性再进行一次筛选 input[type='text']{ width:100px; height:200px; } <input type=

CSS(14)元素定位

徘徊边缘 提交于 2019-12-20 04:20:57
一、元素定位机制   1.普通文档流   普通文档流将浏览器窗体自上而下分成一行行, 并在每行中按从左至右的顺序排放元素。     2.定位思想和浮动   CSS元素定位的基本思想很简单,它 允许我们定义元素框相对于其正常位置应该出现的位置,或者相对于父元素、另一个元素甚至浏览器窗口本身的位置。 此外,CSS中的浮动允许元素向左或者向右移动。通常情况下,我们使用div+css布局页面,而css布局中最重要的就是float属性。    3.一切皆为框   div、h1 或 p 元素常常被称为块级元素。这意味着这些元素显示为一块内容,即“块框”。与之相反,span 和 strong 等元素称为“行内元素”,这是因为它们的内容显示在行中,即“行内框”。可以使用 display 属性改变生成的框的类型。通过将 display 属性设置为 block,可以让行内元素(比如 <a> 元素)表现得像块级元素一样。还可以通过把 display 设置为 none,让生成的元素根本没有框。这样的话,该框及其所有内容就不再显示,不占用文档中的空间。   但是在一种情况下,即使没有进行显式定义,也会创建块级元素。这种情况发生在把一些文本添加到一个块级元素(比如 div)的开头。即使没有把这些文本定义为段落,它也会被当作段落对待: View Code <div> /*文本生是无名框*/ some text

R: Replace elements with NA in a matrix in corresponding positions to NA's in another matrix

三世轮回 提交于 2019-12-20 04:19:01
问题 I have a large matrix, z, that I removed all values >3 and replaced with NA using: z[z>3]<-NA I have another matrix, y , of identical dimensions that I need to replace values with NA in positions corresponding to the locations where the elements were replaced in element z. That is, if z[3,12] was >3 and replaced with NA, I need y[3,12] to be replaced with NA too. They have the same row names if that helps. 回答1: Just use is.na on the first matrix to select the values to replace in the second

pygame how to check mouse coordinates

亡梦爱人 提交于 2019-12-20 01:46:44
问题 I am making a multiple choice quiz game with python and pygame. I have circles and what a want is when you click on the circle it will change the width and make the circle full. But I don't know of a python function that can do that Heres my code so far: # Controls the width of the circles width_1 = 2 width_2 = 2 width_3 = 2 width_4 = 2 # Circles pygame.draw.circle(screen, BLACK, [250, 230], 7, width_1) pygame.draw.circle(screen, BLACK, [250, 260], 7, width_2) pygame.draw.circle(screen, BLACK

pygame how to check mouse coordinates

旧时模样 提交于 2019-12-20 01:46:30
问题 I am making a multiple choice quiz game with python and pygame. I have circles and what a want is when you click on the circle it will change the width and make the circle full. But I don't know of a python function that can do that Heres my code so far: # Controls the width of the circles width_1 = 2 width_2 = 2 width_3 = 2 width_4 = 2 # Circles pygame.draw.circle(screen, BLACK, [250, 230], 7, width_1) pygame.draw.circle(screen, BLACK, [250, 260], 7, width_2) pygame.draw.circle(screen, BLACK

Android RecyclerView的滑动监听

笑着哭i 提交于 2019-12-20 01:30:59
RecyclerView提供了addOnScrollListener 做滑动监听里面提供了两个方法 onScrollStateChanged和 onScrolled 如果只做滑动监听 onScrolled就够用了 从onScrolled方法里面int position = linearLayoutManager.findFirstVisibleItemPosition(); 就能获取到滑动的item 了 //根据索引来获取对应的itemView View firstVisiableChildView = linearLayoutManager .findViewByPosition(position); //获取当前显示条目的高度 int itemHeight = firstVisiableChildView.getHeight(); //获取当前Recyclerview 偏移量 int flag = (position) * itemHeight - firstVisiableChildView.getTop(); flag 这样就获取到滑动的偏移量了,大部分需求都能完成 我这里用到的是类似一个淘宝的tab滑动显示效果 来源: CSDN 作者: 渣渣龙 链接: https://blog.csdn.net/Theprogramleaders/article/details

Android recyclerview 局部刷新问题

若如初见. 提交于 2019-12-20 01:22:11
recyclerview 局部刷新,一般用的是 notifyItemChanged(position); 这个刷新了整个item,但有时候,我只想刷新item里面的一部分,而且刷新整个item的时候,imageview可能会闪屏 这样,用到了另一个方法 notifyItemChanged(POSITION, "share"); 第一个参数不用解释,第二个参数为标识,如果传null的话,会刷新整个item,查源码会看到,notifyItemChanged(position) 其实 就是调用的notifyItemChanged(position,null) 对了 第二个参数,类型随意 接着 在adapter里面 重写 onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position, List payloads) 这个 payloads 只有一个数据,就是 上面说的notifyItemChanged的第二个参数,正好用来做标识判断刷新哪个。。 来源: CSDN 作者: 燕满天 链接: https://blog.csdn.net/yanmantian/article/details/103615971

css之定位

假装没事ソ 提交于 2019-12-20 01:01:10
我们可以使用css的position属性来设置元素的定位类型,postion的设置项如下: relative 生成相对定位元素,元素所占据的文档流的位置不变,元素本身相对文档流的位置进行偏移 absolute 生成绝对定位元素,元素脱离文档流,不占据文档流的位置,可以理解为漂浮在文档流的上方,相对于上一个设置了相对或者绝对或者固定定位的父级元素来进行定位,如果找不到,则相对于body元素进行定位。 fixed 生成固定定位元素,元素脱离文档流,不占据文档流的位置,可以理解为漂浮在文档流的上方,相对于浏览器窗口进行定位。 static 默认值,没有定位,元素出现在正常的文档流中,相当于取消定位属性或者不设置定位属性 inherit 从父元素继承 position 属性的值 定位元素特性 绝对定位和固定定位的块元素和行内元素会自动转化为行内块元素 定位元素层级 定位元素是浮动的正常的文档流之上的,可以用z-index属性来设置元素的层级,谁的z-index值大,谁的元素就在上层。 典型定位布局 1、固定在顶部的菜单 2、水平垂直居中的弹框 3、固定的侧边的工具栏 4、固定在底部的按钮 示例代码 <head> <style type="text/css"> .con{ width:400px; height:400px; border:1px solid #000; margin

ASP.NET Core 2.0 中读取 Request.Body 的正确姿势

微笑、不失礼 提交于 2019-12-19 23:45:41
原文: ASP.NET Core 中读取 Request.Body 的正确姿势 ASP.NET Core 中的 Request.Body 虽然是一个 Stream ,但它是一个与众不同的 Stream —— 不允许 Request.Body.Position=0 ,这就意味着只能读取一次,要想多次读取,需要借助 MemoryStream ,详见博问 asp.net core中2次读取Request.Body的问题 using (var buffer = new MemoryStream()) { Request.Body.CopyTo(buffer); buffer.Position = 0; buffer.CopyTo(writer.BaseStream); Console.WriteLine("Request.Body:"); buffer.Position = 0; buffer.CopyTo(Console.OpenStandardOutput()); } 昨天读了博文 Reading request body in ASP.NET Core 之后得知在 ASP.NET Core 2.0 中已经针对这个问题提供了解决方法 —— EnableRewind() ,只要启用倒带功能,就可以让 Request.Body 回归正常 Stream 。 使用非常简单,引用命名空间

web前端----css属性

*爱你&永不变心* 提交于 2019-12-19 23:38:38
一、文本 1.文本颜色:color 颜色属性被用来设置文字的颜色。 颜色是通过CSS最经常的指定: 十六进制值 - 如: # FF0000 一个RGB值 - 如: RGB(255,0,0) 颜色的名称 - 如: red 2.水平对齐方式 text-align 属性规定元素中的文本的水平对齐方式。 left 把文本排列到左边。默认值:由浏览器决定。 right 把文本排列到右边。 center 把文本排列到中间。 justify 实现两端对齐文本效果。 二、文本其他操作 text-align:cnter 文本居中line heigth 垂直居中 :行高,和高度对应 vertical-align:设置图片与文本的距离 text-decoration:none 去掉超链接下划线font-style:oblique 或者italic....(设置字体的样式为斜体)font-size: 10px; line-height: 200px; 文本行高 通俗的讲,文字高度加上文字上下的空白区域的高度 50%:基于字体大小的百分比 vertical-align:-4px 设置元素内容的垂直对齐方式 ,只对行内元素有效,对块级元素无效 text-decoration:none text-decoration 属性用来设置或删除文本的装饰。主要是用来删除链接的下划线 font-family: