absolute

【原】移动web页面支持弹性滚动的3个方案

时光怂恿深爱的人放手 提交于 2020-01-23 05:35:40
传统 pc 端中,子容器高度超出父容器高度,通常使用 overflow:auto 可出现滚动条拖动显示溢出的内容,而移动web开发中,由于浏览器厂商的系统不同、版本不同,导致有部分机型不支持对弹性滚动,从而在开发中制造了所谓的 BUG。 上图如果在PC端中,我们可以利用 position:fixed 和 overflow:auto 进行简单的布局实现我们需要的效果,而在手机端遇到的问题如下: ios4 和 android2.2 以下不支持 position:fixed ios 和 android2.3 以下 不支持 overflow:auto ios4 和 android 不支持 overflow-scrolling 最严重的结果是:滚动区域内容无法拖动 对于 ios4 和 android2.2 以下不支持 position:fixed 的问题,有2种布局方法可以替代。 布局一: 定义页面整体高度为100%,然后使用 position:absolute 布局可解决 /* <!--absolute布局 [[ --> <body> <div class="wrap"> <div class="header">header</div> <div class="main"> 弹性滚动区域 </div> <div class="footer">footer</div> </div> <

css3实现开门效果

我的梦境 提交于 2020-01-21 02:35:25
css3实现开门效果 < div class = "big" > < div class = "box men" > < div class = "door" > < /div > < div class = "door-t" > < /div > < div class = "door-r" > < /div > < div class = "door-back" > < /div > < /div > < div class = "box mk" > < div class = "door" > < span > open < /span > < /div > < div class = "door-t" > < /div > < div class = "door-r" > < /div > < div class = "door-back" > < /div > < /div > < /div > * { padding : 0 ; margin : 0 ; } body { background-color : rgb ( 19, 76, 109 ) ; } .big { perspective : 1200px ; position : relative ; width : 338px ; height : 538px ; margin : 100px auto ; }

总结让元素水平垂直居中的方法

江枫思渺然 提交于 2020-01-20 10:24:57
前端开发中,我们经常需要对元素进行水平垂直居中。为此,特地总结了让元素居中的方法。 水平居中text-align:center; 这个是没有浮动的情况下,我们可以先将要居中的块级元素设为inline/inline-block,然后在其父元素上加上属性text-align:center;即可。如果要居中的块级元素直接是内联元素(span、img、a等),直接在其父级元素上加上属性text-align:center;即可; 专门建立的学习Q-q-u-n: 731771211,分享学习方法和需要注意的小细节,不停更新最新的教程和学习技巧 (从零基础开始到前端项目实战教程,学习工具,全栈开发学习路线以及规划) .way { border: 1px solid red; width: 250px; } .way img { max-width: 200px; } .way1 { text-align: center; font-size: 0px; //HTML图片之间,浏览器会产生默认的间距,父元素设置font-size:0px;可以很好地解决这个问题。 } <div class="way way1"> <img src="fj.jpg" alt=""> </div> 使用margin:0 auto;水平居中 前提:居中的元素必须是块级元素,如果是内联元素,需要添加属性display

Text Wrapping around an absolute positioned div

最后都变了- 提交于 2020-01-19 05:37:06
问题 I know there are a few questions about similar topics but they mostly amount to floating the div/image. I need to have the image (and div) positioned absolutely (off to the right) but I simply want the text flow around it. It works if I float the div but then I can't position it where I want. As it is the text just flows behind the picture. <div class="post"> <div class="picture"> <a href="/user/1" title="View user profile."><img src="http://www.neatktp.com/sites/default/files/photos

ios设备的弹窗页面,光标错位,光标乱跳

牧云@^-^@ 提交于 2020-01-17 13:11:18
如果产品要求在移动端里有弹窗中多个ipnut,趁早找产品沟通不要弹窗,新起页面,此问题巨坑!巨坑! 如果产品要求在移动端里有弹窗中多个ipnut,趁早找产品沟通不要弹窗,新起页面,此问题巨坑!巨坑! 如果产品要求在移动端里有弹窗中多个ipnut,趁早找产品沟通不要弹窗,新起页面,此问题巨坑!巨坑! 一.经常是上下错位,原因是在input 获取焦点以后,键盘弹出后,会把页面往上顶着移动,但是光标停留在了以前的位置,如果页面不复杂,可以在获取焦点后给body上添加 position:fixed ,使用后清除,但是这样会引起页面失去滚动能力,页面中尽量使用absolute,或者是float,还有flex。 二.还有一种情况就是页面中有了弹窗,在弹窗中有多个input(一般大于2个)标签,会出现光标左右平移,或者光标乱跳,点了第一个光标去了第二个, (1)、左右平移先给input加test-align:left;无效在找别的原因 (2)、此类问题大多解决办法都是把弹窗的fixed定位改为absolute 页面中不要出现fixed定位 (3)、或者是添加fastclick.js库,目前感觉此方法起不到什么作用。。 (4)、仔细观察页面,可以看到页面上的input先聚焦再滚动;也就是说,聚焦事件在页面滚动之前或者滚动完成之前就已经完成了,所以这时候页面滚动,而光标又不跟随滚动,就造成了光标跳行

html中的定位与层级设置

痴心易碎 提交于 2020-01-16 18:45:57
#转载请先留言联系 定位 HTML中的position属性可以对元素进行定位,通过position的不同的值,可以配合方位属性,让元素显示页面中的任何一个位置。 position有四个值: static,默认值,去除元素的定位。也就是不进行定位 relative,相对定位,元素相对于 自身 原来的位置进行定位。 absolute,绝对定位,元素相对于 当前父元素 进行定位。 fixed,固定定位,元素相对于 浏览器页面窗口 进行定位。 怎么定位?css中提供了四个不同方位属性给我们进行定位。 top:表示距离顶部指定的长度 bottom:表示距离底部指定的长度 left:表示距离左边指定的长度 right:表示距离右边指定的长度 示例: 1.relative定位 <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <title>Document</title> <style> .box{ width:200px; height: 200px; background: #000; position: relative; /*让元素相对于自身原有的位置进行定位*/ top:100px; /*向下移动100px*/ left: 100px; /*向左移动100px*/ /*定位中,left与right

实现图片放大并且点击打开后可以单独查看。

感情迁移 提交于 2020-01-16 00:20:55
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title></title> <script src="js/jquery.min.js"></script> <style> *{ margin:0; padding:0; } li{ list-style:none; } .wrap{ width:1200px; height:244px; margin:0 auto; position:relative; /*可以先对div进行设置边框便于查看等确定了再去掉*/ } .tt{ width:200px; height:200px; float:left; margin:20px; } img{ width:200px; height:210px; } .tt:hover img{ margin-left:10px; transform:scale(1.2); transition:all 0.3 ease; } .bg,.diag{ display:none; } .bg{ width:100%; height:100%; top:0; left:0; background:#000000; opacity:0.6; z-index:10; position:absolute; } .diag{ width:500px

谈谈css伪类与伪元素

梦想的初衷 提交于 2020-01-14 14:48:53
css选择器常见包括id(#id)、标签(tag)、class(.class)、属性[attr=attrval]等,还包括伪元素和伪类选择器。正确的利用伪元素和伪类能够让我们的html结构更清晰合理,也能在一定程度上减少js对dom的操作! 定义 伪类 包含两种: 状态伪类 和 结构性伪类 。 状态伪类 是基于元素当前状态进行选择的。在与用户的交互过程中元素的状态是动态变化的,因此该元素会根据其状态呈现不同的样式。当元素处于某状态时会呈现该样式,而进入另一状态后,该样式也会失去。常见的状态伪类主要包括: :link 应用于未被访问过的链接; :hover 应用于鼠标悬停到的元素; :active 应用于被激活的元素; :visited 应用于被访问过的链接,与:link互斥。 :focus 应用于拥有键盘输入焦点的元素。 结构性伪类 是css3新增选择器,利用dom树进行元素过滤,通过文档结构的互相关系来匹配元素,能够减少class和id属性的定义,使文档结构更简洁。常见的包括: :first-child 选择某个元素的第一个子元素; :last-child 选择某个元素的最后一个子元素; :nth-child() 选择某个元素的一个或多个特定的子元素; :nth-last-child() 选择某个元素的一个或多个特定的子元素,从这个元素的最后一个子元素开始算; :nth-of

小白初学HTML的一些小理解

本秂侑毒 提交于 2020-01-14 00:12:01
小白初学HTML 在我学习css语法时遇到了一些问题 在子元素浮动时,导致父元素坍塌。 如何去解决父级元素坍塌的问题 position 的属性 position的实际应用 在我学习css语法时遇到了一些问题 在子元素浮动时,导致父元素坍塌。 <style> .box{ background-color: red; } .box1{ width: 200px; height: 200px; background-color: green; float: left; } .box2{ width: 200px; height: 200px; background-color: blue; float: left; } </style> </head> <body> <div class="box"> <div class="box1"></div class="box1"> <div class="box2"></div> </div> </body> 此时的效果为 父元素设置的红色并没有显示出来,因为他的高度变成了 0。 此时父级元素高度坍塌了。 如何去解决父级元素坍塌的问题 1.为父元素设置高度 .box{ background-color: red; height: 400px; } 此时的显示效果为 这个方法并不好,当要调整子级元素时,父级元素也有相应的做调整。 2.

Creating more complex regexes from TAG format

无人久伴 提交于 2020-01-06 14:07:57
问题 So I can't figure out what's wrong with my regex here. (The original conversation, which includes an explanation of these TAG formats, can be found here: Translate from TAG format to Regex for Corpus). I am starting with a string like this: Arms_NNS folded_VVN ,_, The NNS could also NN, and the VVN could also be VBG. And I just want to find that and other strings with the same tags (NNS or NN followed b VVN or VBG followed by comma). The following regex is what I am trying to use, but it is