position

CSS 巧用 :before和:after

Deadly 提交于 2019-12-10 04:48:47
前几天的晚上较全面的去看了下css的一些文档和资料,大部分的样式运用都没什么大问题了,只是有些许较陌生,但是也知道他们的存在和实现的是什么 样式。今天主要想在这篇学习笔记中写的也不多,主要是针对:before和:after写一些内容,还有几个小样式略微带过的介绍下。 什么是:before和:after? 该如何使用他们? :before是css中的一种伪元素,可用于在某个元素之前插入某些内容。 :after是css中的一种伪元素,可用于在某个元素之后插入某些内容。 下面我们先跑个简单的代码测试下效果: <style> p:before{ content: "H" /*:before和:after必带技能,重要性为满5颗星*/ } p:after{ content: "d" /*:before和:after必带技能,重要性为满5颗星*/ } </style> <p>ello Worl</p> 以上的代码将会在页面中展现的是”Hello World”。我们通过浏览器的”审查元素”看到的内容是: <p> ::before "ello Worl" ::after </p> p标签内部的内容的前面会被插入一个:before伪元素,该伪元素内包含的内容是”H”;而在p标签内的内容后面会被插入一个:after伪元素,该元素包含的内容是”d”。作为一只合格的程序猴子,捍卫”Hello World

How do I get the absolute position of a mouse click from an onClick event on the body?

痞子三分冷 提交于 2019-12-10 04:09:43
问题 I am trying to get the absolute position (top and left) of a mouse click relative to the browser/body, not any parent elements within the body. I have a listener bound to the body, but e.pageX and e.pageY are giving me the position relative to a div. Note that I can leverage jQuery and YUI functions. Code that currently does not work correctly: //getting the position function _handleClick(e) { var data = { absX: e.pageX, absY: e.pageY}; _logClickData(data); } //binding the function var

How to keep background image on bottom left even scrolling

半城伤御伤魂 提交于 2019-12-10 02:47:06
问题 I was wondering if there is a way to keep my background image on bottom left all the time even if the user scroll the browser. My current css can make the image in the bottom of the browser when the site loaded, but if I scroll the browser, it will still stay in the same location. I appreciate any help. html, body { background-image:url("backgroundBottom.png"); background-position:bottom left; background-repeat:no-repeat; background-attachement:fixed; //I just add this, don't think this would

解决position浮动问题:如何相对某个div进行绝对定位.

被刻印的时光 ゝ 提交于 2019-12-10 02:20:44
div提供了一个支持ie及大多数浏览器的浮动方式,就是相对于其上一级的div容器进行浮动,这种做法的好处是定位更加准确,不容易出现差错。 示例: <!-- lang: html --> <div id="A"> <!-- lang: html --> <div id="B"> <!-- lang: html --> </div> <!-- lang: html --> </div> css样式: <!-- lang: css --> #A{position:relative} <!-- lang: css --> #B{position:absolute;top:10px;} 此时B的悬浮是相对于A的,而不是相对于body及html的。B的位置会随着A的移动而改变 来源: oschina 链接: https://my.oschina.net/u/927817/blog/122272

水平居中和垂直居中

倾然丶 夕夏残阳落幕 提交于 2019-12-10 02:14:31
1.水平居中 (1) 文本、图片等行内元素的水平居中   给父元素设置text-align:center可以实现文本、图片等行内元素的水平居中。 (2) 确定宽度的块级元素的水平居中   通过设置margin-left:auto;和margin-right:auto;来实现的。 (3) 不确定宽度的块级元素的水平居中   方法一:   使用table标签,table本身并不是块级元素,如果不给它设定宽度的话,它的宽度由内部元素的宽度“撑起”,但即使不设定它的宽度,仅设置margin-left:auto;和margin-right:auto;就可以实现水平居中!   将需要居中的部分包含在table标签内,对table设置margin-left:auto;和margin-right:auto;就可以使table水平居中,间接使需要居中的部分水平居中。   缺点:增加了无语意标签,加深了标签的嵌套层数。 <style type="text/css">ul{list-style:none; margin:0; padding:0;}.wrap{ width:500px; height:100px;}table{margin-left:auto;margin-right:auto;}.test li{float:left; display:inline; margin-right:5px;

jQuery: Getting px position of an element in Integer format

試著忘記壹切 提交于 2019-12-10 01:22:44
问题 This code works in FF, but not in IE: parseInt($('.scroller').css('left'); In FF it returns 0px; In IE it returns NaN . What's a good way to get a pixel position of an element? <div class="holder"> <div class="scroller"> </div> </div> 回答1: Use offset: $('.scroller').offset().left; offset() returns an object containing the properties left and top , which are the position values relative to the document in pixels. If you want the position relative to the parent element, use position instead.

Top navbar (under header) fixed on top of screen when scrolling

╄→尐↘猪︶ㄣ 提交于 2019-12-10 00:21:22
问题 When scrollbar is on top browser displays: HTML: ------------------------- | HEADER | ------------------------- | NAVBAR | ------------------------- | body | ------------------------- When scrollbar is down NOW browser normally displays: HTML: ------------------------- | | | body | | | ------------------------- But I'd like to have: ------------------------- | NAVBAR | ------------------------- | | | body | | | ------------------------- I tried with: <div id="navbar">...</div> CSS: #navbar {

使用SwipeRefreshLayout和RecyclerView实现仿“简书”下拉刷新和上拉加载

喜你入骨 提交于 2019-12-09 23:16:43
一、概述 我们公司目前开发的所有 Android APP都是遵循 iOS 风格设计的,这并不是一个好现象。我决定将Android 5.x控件引入最近开发的项目中,使用RecyclerView取代以往使用的ListView、GridView,使用SwipeRefreshLayout取代pull-to-refresh第三方库,打造更符合Material Design风格的APP。 本篇博客介绍的就是如何使用SwipeRefreshLayout和RecyclerView实现高仿简书Android端的下拉刷新和上拉加载更多的效果。 根据效果图可以发现,本案例实现了如下效果: 第一次进入页面显示SwipeRefreshLayout的下拉刷新效果 当内容铺满屏幕时,向下滑动显示“加载中…”效果并加载更多数据 当SwipeRefreshLayout正在下拉刷新时,将屏蔽加载更多操作 当加载更多数据时,屏蔽有可能的重复的上拉操作 当向上滑动RecyclerView时,隐藏Toolbar以获得更好的用户体验 二、代码实现 MainActivity package com.leohan.refresh; import android.os.Bundle; import android.os.Handler; import android.support.v4.widget

Android应用程序开发

走远了吗. 提交于 2019-12-09 23:07:23
目录 1. 基于android的简易备忘录的设计与实现... 2 1.1系统需求分析... 2 1.1.1用例分析... 2 1.1.2数据逻辑模型... 4 1.2系统设计... 4 1.2.1主界面功能模块... 4 1.2.2笔记/待办的添加模块... 5 1.2.3备忘录的修改模块... 6 1.2.4备忘录的删除模块... 7 1.3系统数据库设计... 8 1.4系统实现... 9 1.4.1主界面功能的实现... 9 1.4.2添加功能的实现... 16 1.4.3修改功能的实现... 17 1.4.4删除功能的实现... 18 切换布局的实现... 20 1.5系统测试... 22 2课设总结... 23 2.1课设体会... 23 附件... 24 1. 基于android的简易备忘录的设计与实现 1.1系统需求分析 随着Android系统在市场上的强大爆发,在智能手机领域已经成为用户量最多的操作系统。Android智能手机也正在成为人们日常获取信息的主要设备,尤其在“学生一族”和青年群体中表现最为突出,并且通过Android智能手机,他们可以便捷的获取各种所需信息。因此,基于Android的智能手机的便捷服务类应用会有一个很好的发展机会和发展空间,手机随身备忘录就是它们中的一员。 在该系统下的备忘录软件中,可以为用户提供非常方便的备忘事件查询的功能

Strange mootools window dragging behaviour

走远了吗. 提交于 2019-12-09 22:32:02
问题 I have a drag-able mootools modal window. The content of the window is a iFrame. I drag the window from inside the iFrame. (it drags but shakes a lot during dragging) Live link here . Question : why this strange drag behaviour? the iFrame leaves its border, empty, on the origin place. How to avoid this? Thankfull for ideas/tips on were to search for problem. My code: window.addEvent('domready',function() { document.getElementById('iframe2_footer').addEventListener('mousedown', mouseDown,