position

【js】 流式布局 页面

旧时模样 提交于 2019-12-18 02:06:44
<!DOCTYPE html> <html> <head> <meta content="text/html; charset=utf-8" http-equiv="Content-Type" /> <meta charset="utf-8" /> <style type="text/css"> .eblock{ position: absolute;width:200px;min-height:300px; border:1px solid #F00;} </style> <script src="http://r.ytrss.com/rs/js/yintaih5/h5js/lib/jquery.js"></script> <script type="text/javascript"> $(function() { var current; var rowfirst; var rowsecond; var rowthrid; var rowfourth; var index = 1; $(".eblock").each(function() { current = $(this); // 获取首行元素 if (index <= 4) { if (index % 4 == 1) { rowfirst = $(this); } else if (index % 4 == 2) {

纯CSS实现单一div的正多边形变换

只愿长相守 提交于 2019-12-17 23:01:38
纯粹利用CSS,让“单一个”div,从正三角形变换为正八边形(单一div最多只能做到正八边形),最后再搭配动画的效果,变成正多边形的变换动画,也由于正多边形需要用到不少的三角函数计算,为了方便起见,这里将正多边形的边统一都设为100px。 正三角形 正三角形不需要用到伪元素,只需要设定div本身的边框宽度即可产生,先来看一下正三角形的边长与中线,若边长为100px,则中线四舍五入就是87px(100 x sin(60)= 87)。 因此我们要将div的长宽都设为0,接着把底部border的宽度设为87px,左右的border宽度设为50px(颜色设为透明transparent),就可以做出一个漂亮的三角形。 width:0; height:0; border-width:0 50px 87px ; border-style:solid; border-color:transparent transparent #095; web前端开发学习Q-q-u-n: 731771211,分享学习的方法和需要注意的小细节,不停更新最新的教程和学习方法 (从零基础开始到前端项目实战教程,学习工具,职业规划 ) 正方形 正方形应该是最简单的,只要设定长宽设定为同样数值就可以了,不过其实还有另外两种方法,第一种你可以把长宽设为0,把上下左右的border设为50px也可以,第二种则是高度设为0

How to position the div popup dialog to the center of browser screen?

拟墨画扇 提交于 2019-12-17 22:25:11
问题 I need to position div popup to the center of browser screen ( no matter what size the screen is). And I want to keep the position as absolute as I don't want to move the popup down when I scroll down the page. This div is displayed when button is clicked using Jquery. I tried setting margin-left to half of the width like mentioned in other posts but It isn't working for me. Here is my code CSS code: .holder{ width:100%; position:absolute; left:0; top:0px; display:block; } .popup{ width:800px

Get the last div in a row of floating divs

China☆狼群 提交于 2019-12-17 19:32:27
问题 I have a number of divs floating in several rows. The divs contain text-previews and a link to slide down the full content (see http://jsfiddle.net/yDcKu/ for an example). What happens now: When you slide down the content-div it opens right after the connected preview. What I want to happen: Open the content-div after the last div in the row. I assume the could be done by: 1. find out which div is the last one in the row of the activated preview, 2. add an id to this div and 3. append the

How can I get position of cursor in terminal?

a 夏天 提交于 2019-12-17 18:29:11
问题 I know I may save position using tput sc , but how can I read it's position to the variable? I need the number of row. I don't want to use curses/ncurses. 回答1: At ANSI compatible terminals, printing the sequence ESC[6n will report the cursor position to the application as (as though typed at the keyboard) ESC[n;mR , where n is the row and m is the column. Example: ~$ echo -e "\033[6n" EDITED: You should make sure you are reading the keyboard input. The terminal will "type" just the ESC[n;mR

css 定位属性:position

强颜欢笑 提交于 2019-12-17 18:23:37
对于position一直存有一些疑惑,特别是相关联的z-index属性,更是有些摸不着头脑,今天好好学习一下position属性的各个值不同的表现形式 语法: position:static | relative | absolute | fixed 默认值:static 取值: static: 无特殊定位,对象遵循正常文档流。top,right,bottom,left等属性不会被应用 relative: 对象遵循正常文档流,但将依据top,right,bottom,left等属性在正常文档流中偏移位置 absolute: 对象脱离正常文档流,使用top,right,bottom,left等属性进行绝对定位。而其层叠通过z-index属性定义 fixed: 对象脱离正常文档流,使用top,right,bottom,left等属性以窗口为参考点进行定位,当出现滚动条时,对象不会随着滚动。IE6及以下不支持此参数值 说明: 检索对象的定位方式。 对应的脚本特性为position。 兼容性: 都支持,除IE6不支持fixed取值参数 上面的说法比较全面,但是不易理解,我做了一个demo页面,从实例出发,一目了然,代码如下: View Code <!doctype html> <html lang="zh-CN"> <head> <meta charset="utf-8" />

Get character position in alphabet

帅比萌擦擦* 提交于 2019-12-17 18:14:47
问题 I'm 90% sure there is a built in function that does this. I need to find the position of a character in an alphabet. So the character "b" is position 1 (counting from 0), etc. Does anyone know what the function is called? Thanks in advance! EDIT: What i'm trying to do is to send all the characters X amount of "steps" back in the alpha bet, so if i have a string with "hi" it would be "gh" if i sent it back one step. There might be a better way of doing it, any tips? 回答1: It is called index .

Using jQuery to keep scrolling object within visible window

会有一股神秘感。 提交于 2019-12-17 18:11:17
问题 I was in the middle of writing up a long description of what I wanted to do, when I realized that the "How To Ask / Format" sidebar box on this very same "Ask A Question" page does exactly what I want. Basically, it scrolls up and down in unison with the rest of the screen, staying top-aligned with the main section, unless the main section starts to scroll off the top of the visible window. At that point, the sidebar box stops scrolling, and starts to act as if its positioned absolutely,

CSS3 box-sizing: margin-box; Why not?

帅比萌擦擦* 提交于 2019-12-17 17:32:22
问题 Why don't we have box-sizing: margin-box; ? Usually when we put box-sizing: border-box; in our style sheets we really mean the former. Example: Let's say I have a 2 column page layout. Both columns have a width of 50%, but they look kind of ugly because there's no gutter (gap in the middle); Below is the CSS: .col2 { width: 50%; float: left; } To apply a gutter you might think we could just set a right margin on the first of the 2 columns; something like this: .col2:first-child { margin-right

CSS make colours go off to sides

落爺英雄遲暮 提交于 2019-12-17 16:54:10
问题 Bit of a vague title, but I wasn't sure of how best to describe it. I've created a fiddle (https://jsfiddle.net/h87k8146/) of two divs within a wrapper. So what I want to achieve is have all content remain within the wrapper, but with the background of .left and .right stretching out to fill the rest of the screen. Current CSS .wrap { width:80%; position:relative; margin:0px auto; } .left { float:left; width:70%; height:300px; background:#F4E6D7; } .right { float:right; width:30%; height