margin-left

你不知道的css高级应用三种方法——实现多行省略

可紊 提交于 2019-12-18 16:04:43
前言 这是个老掉牙的需求啦,不过仍然有很多人在网上找解决方案,特别是搜索结果排名靠前的那些,都是些只会介绍兼容性不好的使用 -webkit-line-clamp 的方案。 如果你看到这篇文章,可能代表你正是从那么多千篇一律的文章中跳转过来的,想找更好地方案的。那恭喜你,没有更好的,只有更合不合适的,当然,前提是我的文章流量够多,能被顶上去你才有机会看到。 这里介绍三种多行文本截断的方法,当然第一种就是你看到想吐的 -webkit-line-clamp 方案,不想看就直接跳到第二种方法开始看啦。 使用-webkit-line-clamp 对多行文本的容器应用如下样式 div { display: -webkit-box; -webkit-box-orient: vertical; overflow: hidden; -webkit-line-clamp: 2; } 除了 -webkit-line-clamp 其他属性固定不变,主要是将对象作为弹性伸缩盒子模型显示,并设置伸缩盒对象的子元素的排列方式。 而 -webkit-line-clamp 是用来控制多少行进行省略 优点 : 浏览器原生支持的省略行为,样式看起来很舒服 简单方便使用 缺点 : 看属性的前缀就知道,这是 webkit 内核的浏览器支持的,兼容性不是广泛。 使用场景 如果你只针对webkit内核浏览器或者移动端

鼠标移入文字上向右移动效果

微笑、不失礼 提交于 2019-12-08 20:56:32
例子1: <style> h1, h2, h3, h4, h5, h6 { font-size: 100%; font-weight: normal; } a { outline: none; color: #21759b; } a:link { color: black; margin-left: 10px; text-decoration: none; } a:visited { color: black; text-decoration: none; } a:hover { color: #21759b; } a:active { color: black; text-decoration: none; } .postTitle { border-left: 12px solid #21759b; margin-bottom: 10px; font-size: 20px; width: 100%; } .postTitle a:link, .postTitle a:visited, .postTitle a:active { color: #21759b; transition: all 0.4s linear 0s; } .postTitle a:hover { margin-left: 30px; color: #0f3647; text-decoration: none

移动端页面

家住魔仙堡 提交于 2019-12-08 00:37:36
1.引入jquery.js和adaptive.js adaptive.js (function (win, lib) { var doc = win.document; var docEl = doc.documentElement; // 设备像素比 var devicePixelRatio = win.devicePixelRatio; // 我们设置的布局视口与理想视口的像素比 var dpr = 1; // viewport缩放值 var scale = 1; // 设置viewport function setViewport() { // 判断IOS var isIPhone = /iphone/gi.test(win.navigator.appVersion); // 布局视口与理想视口的值与设备像素比相等 只针对iphone if (isIPhone) { // if (devicePixelRatio >= 3) { // dpr = 3; // } // else if (devicePixelRatio === 2) { // dpr = 2; // } // else { // dpr = 1; // } // } // else { dpr = 1; } // window对象上增加一个属性,提供对外的布局视口与理想视口的值 win

div+css网页粗略布局

本秂侑毒 提交于 2019-12-06 11:44:52
我们打开浏览器看到各大网站的导航首页如图,是怎么做出来的呢? 比如就拿素描来说吧,看到一个参照物首先不是一开始就画,而是先确定几何构物线,确定物体大致范围比例框架。网页也是的,这就是div+css布局。 这时打开ide或是notepad++之类的编辑工具,开始编写代码 以及截图测量工具faststone capture,用于取色,测量等 我们先别急着编码,我们画个大致的框架,更好方便我们布局 有了设计图之后,便开始按比例尺寸编写div+css布局 打开测量工具,取出标尺,以及编辑工具 编写html代码,做个类似草稿的效果,再创建一个.css,过会编写 <html> <head> <link rel="stylesheet" type="text/css" href="home.css"/> <!--外联css的固有格式,href指向调用的.css文件--> <meta http-equiv="content-type"type="text/html charset=utf-8"/> <!--字符编码设置成utf-8--> <title>home</title> <!--标题设置--> </head> <body> <div id="spe">火狐主页</div> <!--div+css盒子模型,id选择器复用性低,但优先级高,class选择器,反之亦然--> <div id=

定时器的暂停,继续,刷新

吃可爱长大的小学妹 提交于 2019-12-06 10:44:18
页面挂载的时候定时器搞起 <el-row> <div class="ui-toolbar" style="height: 32px; line-height: 32px;"> <div style="margin-left:10px;" :class="isExecuteTiming ? 'green': 'red'">AUTO Refresh</div> <div style="margin-left:10px; margin-right:10px;"> <el-input v-model="autoRefreshInterval" style="width:50px;padding:0;text-align:center" @change="RefreshIntervalChange($event)"></el-input> </div> <div style="color: gray;">秒</div> <div style="margin-left:20px;cursor: pointer" @click="stopAutoRefreshTimer()" v-if="autoRefreshTimer !== null"> <img style="margin-top:10px;" src="@/assets/img/icon/ico_btn_stop.png" title=

多张图片的左右切换特效,实现循环切换

最后都变了- 提交于 2019-12-06 03:59:45
一个页面同时要显示多个图片,并且需要实现这多个图片的循环切换。 贴代码: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> < html xmlns = "http://www.w3.org/1999/xhtml" > < head > < meta http-equiv = "Content-Type" content = "text/html; charset=utf-8" /> < title > jQ左右滑动切换特效 </ title > < link rel = "stylesheet" href = "css/style.css" type = "text/css" /> </ head > < body > < div class = "bodyCon08" > <!--学员--> < div class = "students" > < div id = "four_flash" > < div class = "flashBg" > < ul class = "mobile" > < li > < img src = "images/senke_xy00.jpg" /> <

三栏布局之双飞翼布局(两侧固定宽度,中间自适应)

橙三吉。 提交于 2019-12-05 23:33:38
1、双飞翼布局 双飞翼布局是由淘宝开发人员提出,和圣杯布局有一些相似 2、原理 前四点都和圣杯布局一样 1.写结构,一个大盒子里放三个子元素,注意三个子元素的顺序:中-左-右 2.给三个子元素写float:left; 3.给左侧的盒子设置margin-left:-100%; 4.给右侧的盒子设置margin-left:-右侧盒子盒子宽度 5.给中间的盒子再放一个子元素,给这个子元素设置padding:0 右侧盒子的宽度 0 左侧盒子的宽度 或 设置margin : 0 右侧盒子的宽度 0 左侧盒子的宽度 6.别忘记给父元素清除浮动 7.给大盒子设置最小宽度 代码: <style> .left{ width: 300px; height: 200px; background: pink; float: left; margin-left: -100%; } .center{ width: 100%; height: 300px; background:orange; float: left; } .right{ width: 200px; height: 200px; background: skyblue; float: left; margin-left: -200px; } .centerMain{ background: green; margin:0 200px 0

Bootstrap提供了六种列表效果

徘徊边缘 提交于 2019-12-05 12:20:24
列表--简介 在HTML文档中,列表结构主要有三种:有序列表、无序列表和定义列表。具体使用的标签说明如下: 无序列表 <ul> <li>…</li> </ul> 有序列表 <ol> <li>…</li> </ol> 定义列表 <dl> <dt>…</dt> <dd>…</dd> </dl> Bootstrap根据平时的使用情形提供了 六种 形式的列表: ☑ 普通列表 ☑ 有序列表 ☑ 去点列表 ☑ 内联列表 ☑ 描述列表 ☑ 水平描述列表 接下来,我们一起来学习Bootstrap提供的这六种列表的使用方法 <!DOCTYPE HTML> <html> <head> <meta charset="utf-8"> <title>列表--简介</title> <link rel="stylesheet" href="//netdna.bootstrapcdn.com/bootstrap/3.1.1/css/bootstrap.min.css"> </head> <body> <ul> <li>无序列表信息1</li> <li>无序列表信息2</li> <li>无序列表信息3</li> </ul> <ol> <li>有序列表信息1</li> <li>有序列表信息2</li> <li>有序列表信息3</li> </ol> <dl> <dt>定义列表标题</dt> <dd>定义列表信息1<

windows 安全

自闭症网瘾萝莉.ら 提交于 2019-12-05 02:07:19
Windows基础篇 */ /*--> */ Windows基础篇 1. 系统目录,服务,端口,,注册表 windows program files 用户 perflogs perflogs(win7日志信息 系统自动生成 删除降低系统速度) 服务 服务决定计算机的一些功能是否被启用 不同服务对应的功能不同 通过计算机提供的服务可以有效实现资源共享 web服务 dns 服务 邮件服务 telent服务 ssh服务 ftp服务 smb服务 端口 port(netstat -ano) 公认端口Well Known Ports 注册端口 Reistered Ports 动态/私有端口 Dynsmic snd/or Private Ports 知名端口Well_Known Ports 1-1024 动态端口 Dynamic Ports 一般不固定分配给某个服务 TCP端口 UDP端口 HTTP:80/8080/3128/8081/9080 FTP:21 Telnet:23 TFTP:69/UDP SSH SCP:22/TCP SMTP:25/TCP POP3 POST Office:110/TCP TOMCAT:8080 WIN2003:3389 ORACLE :1521 MSSQL*SERVER数据库server:1433/tcp 1433/udp QQ 11080/udp 端口的作用·

C#快速入门指南

一世执手 提交于 2019-12-04 03:57:54
<!doctype html> <html> <head> <meta charset='UTF-8'><meta name='viewport' content='width=device-width initial-scale=1'> <title>RSMX</title><style type='text/css'>html {overflow-x: initial !important;}:root { --bg-color:#ffffff; --text-color:#333333; --select-text-bg-color:#B5D6FC; --select-text-font-color:auto; --monospace:"Lucida Console",Consolas,"Courier",monospace; } html { font-size: 14px; background-color: var(--bg-color); color: var(--text-color); font-family: "Helvetica Neue", Helvetica, Arial, sans-serif; -webkit-font-smoothing: antialiased; } body { margin: 0px; padding: 0px; height: