css常见小问题(自己遇到的)
- 禁止div点击
//css属性:
pointer-events: none;
//或者定义属性,在js中添加:
$(".原类名").addClass("新类名");
//js:
//禁用
$.fn.disable = function () {
$(this).addClass("disable");
};
//启用
$.fn.enable = function () {
$(this).removeClass("disable");
};
//或者
$("#@id").disable();
$("#@id").enable();
- 鼠标放置显示“小手”手势,并显示提示文字
<div style="cursor:pointer;" title="提示的信息">这里是文字内容</div>
- 超出区域的文字显示省略号
//1.普通情况
display:inline-block; //这个看情况加
overflow:hidden; /*超出部分隐藏*/
white-space:nowrap; /*让文本强制在一行不换行*/
text-overflow:ellipsis;/*显示省略号来代表被修剪的文本*/ /*2.长的英文单词换行*/
word-break:break-all; /*支持IE,chrome,FF不支持*/
word-wrap:break-word;/*支持IE,chrome,FF*/ /*3.两行截取 2行超出显示...*/
.mui-ellipsis-2 {
display: -webkit-box;
overflow: hidden;
white-space: normal!important;
text-overflow: ellipsis;
word-wrap: break-word;
-webkit-line-clamp:;
-webkit-box-orient: vertical;
} /*4.select的情况下*/
<select onmouseover="selbox($(this))" ></select>
<script>
function selbox(a){
var val = a.val();
a.attr("title",val);
}
- div+css控制图片等比例缩放:
/*外侧div设置宽、高,内侧图片设置宽、高为auto;并且设置max-width和max-height为同等比例*/ .imgbox50{
width:200px;
height:50px;
border-radius:50%;
text-align: center;
margin:0 auto;
}
.Img50{
max-width:85%;
max-height:85%;
border-radius:5px;
width:auto;
height:auto;
}
<div class="imgbox50 mt5">
<img class="Img50" src="">
</div>
- ui样式
第一个li的样式:li:first-child { background:#f00; }
最后一个li的样式:li:last-child { background:#000; }
第n个li的样式:li:nth-child(n) { background:#000; }
倒数第二个li的样式:nth-last-of-type(2){ background:#000; }
奇数列表:li:nth-child(odd) { background:#f00; }
偶数列表:li:nth-child(even) { background:#f00; }
- 设置元素在另一个元素的最底部
//设置父div的
position:relative;
//子div
position: absolute;
bottom:0;
- 设置背景颜色,不透明度
background-color:#6d7a83;
opacity:0.75;
- select文字对齐方式
//右对齐
select {
direction: rtl;
}
//左对齐
select option {
direction: ltr;
}
//居中对齐设置padding
- input设置提示文字的颜色
/* WebKit browsers */
input::-webkit-input-placeholder {color: red; }
/* Mozilla Firefox 4 to 18 */
input:-moz-placeholder { color: red; }
/* Mozilla Firefox 19+ */
input::-moz-placeholder { color: red; }
/* Internet Explorer 10+ */
input:-ms-input-placeholder {color: red; }
- 修改select下拉按钮的样式是自定义的:
select::-ms-expand { display:none; }//隐藏自带的样式
select{
height:30px;
line-height:28px;
padding:0 16px 0 5px;
border:1px solid #e4e4e4;
background: url("/zbw/img/mobile/public/icon/sjxdown.png") right center no-repeat #fff;
background-size:16px;
text-align:left;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
appearance:none;
-moz-appearance:none;
-webkit-appearance:none;
cursor:pointer;
}
- table中多个tr之间的间距
<tr style="display:block;margin-top:10px;"></tr>
- 两个div之间加个竖线样式
<div style="margin-top: 20px;width:1px;height:80px;float:left;background:#e4e4e4;"></div>
- textarea禁止拉伸
style="resize:none"
css常见小问题(自己遇到的)的更多相关文章
- css常见属性
css常见属性 1.颜色属性 1.1 color属性定义文本的颜色 1.2 color:green 1.3 color:#ff6600 可简写为#f60 1.4 color:rgb(255,255,2 ...
- CSS 常见的8种选择器 和 文本溢出问题
<!DOCTYPE html><html> <head> <meta charset="UTF-8"> <title>c ...
- CSS基础【2】:CSS常见属性
CSS常见属性 文字属性 font-style 作用:规定文字样式 格式:font-style: italic; 取值: normal:正常的,默认就是正常的 italic:倾斜的 font-weig ...
- css CSS常见布局解决方案
CSS常见布局解决方案说起css布局,那么一定得聊聊盒模型,清除浮动,position,display什么的,但本篇本不是讲这些基础知识的,而是给出各种布局的解决方案.水平居中布局首先我们来看看水平居 ...
- CSS 黑魔法小技巧,让你少写不必要的JS,代码更优雅
首页 登录注册 CSS 黑魔法小技巧,让你少写不必要的JS,代码更优雅 阅读 8113 收藏 927 2017-09-26 原文链接:github.com 腾讯云容器服务CSS,立 ...
- 前端进阶系列(二):css常见布局解决方案
水平居中布局 margin+定宽 <div class="parent"> <div class="child">Demo</di ...
- css的小技巧
前几天看到<css揭秘>这本书,第一感觉是 css怎么能出这么厚的一本书,不过 细细一想,用好css真的可以实现很多想要的效果,节省很多js代码. 总结几个css的小技巧: 1,将所有元素 ...
- 一些常用的html/CSS效果---小技巧
我常用的重置样式表reset.css /*===============基础信息================*/ *{border: 0;padding: 0;margin: 0;} table ...
- 如何使用CSS实现小三角形效果
如何使用CSS实现小三角形效果:建议:尽可能的手写代码,可以有效的提高学习效率和深度.在众多的网页效果中,都有小三角形效果的应用,能够增加特定应用的美观度,下面就给出一段实例代码,里面介绍了两种实现小 ...
随机推荐
- 能当壁纸用的Git常用命令速查表
使用Microsoft Office 2016手工绘制. 链接: https://pan.baidu.com/s/18KsH-u5T2iSTHaXd6iQWGA 提取码: w8da 复制这段内容后打开 ...
- pycharm问题合集
一 打开pycharm出现 点击右上角的配置之后 配置正确的python路径 又出现 解决办法 删除所有的解释器,据说是重名导致的. 然后在配置一次 二 ModuleNotFoundError: ...
- 辨析 const指针 和 指向常量的指针
辨析以下几种指针p的定义. ; int *p = &tmp; const int *p = &tmp; int const* p = &tmp; int * const p = ...
- layui 数据表格自适应高度
添加css .layui-table-cell { height: inherit; } .layui-table-cell { height: inherit;}
- 解决PHP中json_encode()不支持中文的替代函数
json_encode()是PHP中将数组转换成JSON格式的函数,因为各种原因只要是中文就会乱码= = 找到了这么一个函数替代了原有的json_encode(),能很好地输出中文~ function ...
- LoadRunner(1)
性能测试:HP LoadRunner11 一.初步概念: 1.功能测试:测试产品的功能是否满足功能需求. 如:ATM取款(在线取款)是否成功或转账操作是否成功 -- 一个用户 2.性能测试:测试产品的 ...
- phpstorm激活码
激活码1 812LFWMRSH-eyJsaWNlbnNlSWQiOiI4MTJMRldNUlNIIiwibGljZW5zZWVOYW1lIjoi5q2j54mIIOaOiOadgyIsImFzc2ln ...
- hive三种调用方式
一.hive -e ‘sql语句’ (shell命令) 适合比较短的sql语句调用,优点是可以直接在shell中调用静音模式 -S 在执行HiveQL过程中,不在显示器输出MR的执行过程hive -S ...
- 5 LAMP配置管理:模块(state、file、pkg、service)、jinja模板、job管理、redis主从
1. 配置管理:state和file https://docs.saltstack.com/en/latest/topics/states/index.html Full list of states ...
- Linux系统安装xinetd服务
只需安装xinetd包 安装包 #yum -y install xinetd 安装成功后即可 service xinetd start service xinetd stop service xine ...