css使用user-select,user-select不是W3C标准,浏览器支持不完整;user-select有两个值,none用户不可以选择文本,text用户可以选择文本

body{
-moz-user-select: none; /*火狐*/
-webkit-user-select: none; /*webkit浏览器*/
-ms-user-select: none; /*IE10*/
-khtml-user-select: none; /*早期浏览器*/
user-select: none;
}

也可以使用js控制

document.body.onselectstart = document.body.ondrag = function(){
return false;
}

对于table中含有class影响了td中的class,使其不起作用,如:

.pTable td{
background-color: red;
}
.pTd{
background-color: blue;
}
<table class="pTable">
<tr>
<td class="pTd">asdfs</td>
</tr>
</table> 这种情况下.pTd就不起作用,需要为其加上!important
.pTd{
background-color: blue !important
;
}

jquery获得元素坐标

一、获得坐标

1.offset()

offset() 方法返回或设置匹配元素相对于文档的偏移(位置)。(即视口坐标)

该方法返回的对象包含两个整型属性:top 和 left,以像素计。

此方法只对可见元素有效。

2.position()

position() 方法返回匹配元素相对于父元素的位置(偏移)。(相对于父元素的文档坐标)

该方法返回的对象包含两个整型属性:top 和 left,以像素计。

此方法只对可见元素有效。

3.offsetParent()

offsetParent() 方法返回最近的祖先定位元素。

定位元素指的是元素的 CSS position 属性被设置为 relative、absolute 或 fixed 的元素。

可以通过 jQuery 设置 position,或者通过 CSS 的 position 属性。

二、获得尺寸

1.width() 和 height() 方法

width() 方法设置或返回元素的宽度(不包括内边距、边框或外边距)。

height() 方法设置或返回元素的高度(不包括内边距、边框或外边距)。

2.innerWidth() 和 innerHeight() 方法

innerWidth() 方法返回元素的宽度(包括内边距)。

innerHeight() 方法返回元素的高度(包括内边距)。

3.outerWidth() 和 outerHeight() 方法

outerWidth() 方法返回元素的宽度(包括内边距和边框)。

outerHeight() 方法返回元素的高度(包括内边距和边框)。

outerWidth(true) 方法返回元素的宽度(包括内边距、边框和外边距)。

outerHeight(true) 方法返回元素的高度(包括内边距、边框和外边距)。

最新文章

  1. C语言 独木舟问题
  2. python_selenium智联搜索
  3. SQL存储过程,使用事务(try catch),游标
  4. 通过源码分析MyBatis的缓存
  5. ubuntu使用
  6. asp.net 分页-利用后台直接生成html分页
  7. yahoo 交易数据
  8. Objective-C Runtime 运行时之三:方法与消息
  9. Linux最大文件打开数
  10. cmd命令行进入DOS方式编译运行C语言程序实现字符串转换
  11. Python学习之二:Python 与 C 区别
  12. TensorFlow.org教程笔记(二) DataSets 快速入门
  13. Scrapy 原理
  14. Suse linux enterprise 11添加设置中文输入法的方法
  15. 在GDAL中添加GDALRasterizeGeometriesBuf函数
  16. linnux-shell知识
  17. 导出 java.io.IOException: 权限不够
  18. 分布式架构核心RPC原理
  19. 40行代码爬取猫眼电影TOP100榜所有信息
  20. Leetcode Find Minimum in Rotated Sorted Array 题解

热门文章

  1. Beta版本冲刺———第六天
  2. Beta冲刺---Day2
  3. 不停止MySQL服务的情况下修改root的密码
  4. [转]session 持久化问题(重启服务器session 仍然存在)
  5. Javascript写了一个2048的游戏
  6. 725C
  7. Html一天入门
  8. 做哪些优化,才能让 UITabelView 更顺滑?(转)
  9. bzoj4402: Claris的剑
  10. 快速提高 Xcode 编译速度的方法(转载自网上一个大神的方法)