什么?这是要做前端的节奏吗?只要公司有需要,我分分钟变身、前端、美工、UI、交互、后端、数据库管理员......快速学习、快速响应,快速适应。公司需要我干啥,我就干啥,而我存在于公司的意义就是利用所学的东西帮公司解决问题......事实上,如果让一个人来搞定整个项目包括移动端、PC端等等,那你还不是被逼得啥都会。

垂直居中+自动换行

样式效果如下所示,当文字没有超出一行时,显示如“备注信息”,当文字超出一行时,显示如“维修地点”

HTML代码如下:

                    <div class="mui-input-row multi-line">
<div class="box label-right">
<div class="div-leftauto">维修地点</div>
<div class="wrap">广东省深圳市南山区西丽街道桃源路1001号</div>
</div>
</div>

css样式如下:

/*不固定高宽div垂直居中的方法:其它页用*/
.box {width: 100%;height: 40px;border: 1px solid #FFF;display: table;margin-right:5px;}
.wrap{display: table-cell; vertical-align: middle; width: 100%;padding: 6px 0px;line-height: 26px;word-wrap: break-word; word-break: break-all;}
.mui-input-row .div-leftauto{width:110px; display: inline-block;vertical-align: middle;margin-left:5px;/*padding-top: 8px;vertical-align:top;*/}
.mui-input-row.multi-line{height: auto;}

需要注意的是代码:word-wrap: break-word; word-break: break-all;

如果不加上这代码的话,当<div class="wrap">中的文字全部是数字或者英文的时候将不会出现自动换行。

文字超出行显示省略号

如下图所示:

代码:

 <div style="overflow: hidden;white-space: nowrap;text-overflow: ellipsis;"> 是文字随便几行我是文字随便几行我是文字随便几行我是文字随便几行我是文字随便几行我是文字随便</div>

这里只支持单行省略号,如果是多行呢?

    <div style="display: -webkit-box;-webkit-box-orient: vertical;-webkit-line-clamp: 3;overflow: hidden;">
是文字随便几行我是文字随便几行我是文字随便几行我是文字随便几行我是文字随便几行我是文字随便几行是文字随便几行我是文字随便几行我是文字随便几行我是文字随便几行我是文字
随便几行我是文字随便几行是文字随便几行我是文字随便几行我是文字随便几行我是文字随便几行我是文字随便几行我是文字随便几行
</div>

运行结果如下:

我们看到只显示了三行,那是因为我-webkit-line-clamp: 3。这里设置为3.

因使用了WebKit的CSS扩展属性,该方法适用于WebKit浏览器及移动端;

-webkit-line-clamp用来限制在一个块元素显示的文本的行数。 为了实现该效果,它需要组合其他的WebKit属性。

如结合如下属性:

  • display: -webkit-box; 必须结合的属性 ,将对象作为弹性伸缩盒子模型显示 。
  • -webkit-box-orient 必须结合的属性 ,设置或检索伸缩盒对象的子元素的排列方式 。

斜三角形并带文字效果

效果如下图所示:

HTML如下:

  <div class="font-topright"">待完工</div>
<div class="triangle-topright mui-badge-orange"></div>
<div class="font-seal">待料</div>

CSS代码(注意样式的命名,不要搞神马大小写,建议用-或者_连接,统一使用小写):

.font-seal {
font-size: 12px;z-index:;position: absolute;right:14px;top: 35px; border: 1px solid #F73A3C;
transform: rotate(45deg);width: 53px;line-height: 20px;text-align: center;color: #F73A3C;font-weight: bold;
} /**
* 三角形气泡
*/
.triangle-topright {
width:;height:;border-top: 44px solid #FD9D2D;border-left: 2rem solid transparent;
}
.font-topright {
font-size: 12px;z-index:;position: absolute;right: -4px;top: -2px;
transform: rotate(45deg);-webkit-transform: rotate(45deg);-moz-transform: rotate(45deg);
-ms-transform: rotate(45deg);-o-transform: rotate(45deg);width: 43px;line-height: 43px;text-align: center;color: #FFFFFF;
}
.mui-badge.mui-badge-orange{background-color:#FC9C2D;color:#FFFFFF;}

时间轴效果

时间轴设计的难点在于所有的节点都是动态渲染的,最新的节点又和其它节点的样式不一致,节点的显示位置比较难控制,还有就是节点之间的连线必须恰到好处的把各个节点连接起来。

最终渲染的HTML代码:

<body class="mui-ios mui-ios-11 mui-ios-11-0">
<div id="app" class="mui-content" style="background-color: rgb(255, 255, 255);">
<div class="empty-container" style="display: none;">
<div class="nodata-info">暂无相关内容</div>
<div class="nodata-icon">
<span class="mui-icon iconfont icon-wuneirong"></span>
</div>
</div>
<section id="cd-timeline" class="cd-container" style="">
<div class="cd-timeline-block">
<div class="cd-timeline-img cd-picture"></div>
<div class="cd-timeline-content">
<div>用户4,工单结束</div> <div class="cd-date">2018-05-22 14:33:58</div>
</div>
</div>
<div class="cd-timeline-block">
<div class="cd-timeline-img cd-movie"></div>
<div class="cd-timeline-content">
<div>用户4,工作人员到场签到</div>
<div class="cd-date">2018-05-22 14:33:44</div>
</div>
</div><div class="cd-timeline-block">
<div class="cd-timeline-img cd-movie"></div> <div class="cd-timeline-content">
<div>用户4,分配工作人员</div>
<div class="cd-date">2018-05-22 14:33:34</div>
</div>
</div>
<div class="cd-timeline-block">
<div class="cd-timeline-img cd-movie"></div>
<div class="cd-timeline-content"><div>用户4,提交报修单</div> <div class="cd-date">2018-05-21 18:06:44</div></div>
</div>
</section>
</div>
</body>

CSS样式timeline.css

[v-cloak] {display: none !important;}/*visibility: hidden;*/
/* --------------------------------
Primary style
-------------------------------- */
/*html{background-color: #FFFFFF;}*/
.mui-bar{background-color: #449DED;}
.mui-bar-nav .mui-icon {color: #FFFFFF;}
.mui-title {color: #fff;}
*, *:after, *:before {
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}
img {max-width: 100%;}
/* --------------------------------
Modules - reusable parts of our design
-------------------------------- */
.cd-container {
/* this class is used to give a max-width to the element it is applied to, and center it horizontally when it reaches that max-width */
width: 100%;max-width: 1170px;margin:;
}
.cd-container::after {
/* clearfix */
content: '';display: table;clear: both;
}
/* --------------------------------
Main components
-------------------------------- */
#cd-timeline {
position: relative;padding:;margin-top:;margin-bottom: 1em;
}
/*#cd-timeline::before {
content: '';position: absolute;top: 0;left: 18px;
height: 80%;width: 1px;background: #C3E3FF;top:20px;
}*/
.cd-timeline-block:before{
content: '';position: absolute;height: 67px;width: 1px;
background: #C3E3FF;left: 25px;bottom: -28px;
}
.cd-timeline-block:first-child:before{
top: 28px;
}
.cd-timeline-block:last-child:before{
height: 0px;
}
#cd-timeline::after {
height: 0px;
}
@media only screen and (min-width: 1170px) {
#cd-timeline {
margin-top: 3em;margin-bottom: 3em;
}
#cd-timeline::before {
left: 50%;margin-left: -2px;}
}
.cd-timeline-block {
position: relative;margin: 2px 0 0 0;
}
.cd-timeline-block:after {
content: "";display: table;clear: both;
}
.cd-timeline-block:first-child {
margin-top:;
}
.cd-timeline-block:last-child {
margin-bottom:;
}
@media only screen and (min-width: 1170px) {
.cd-timeline-block {
margin: 4em 0;
}
.cd-timeline-block:first-child {
margin-top:;
}
.cd-timeline-block:last-child {
margin-bottom:;
}
}
.cd-timeline-img {
position: absolute;top:;left:;width: 16px;height: 16px;border-radius: 50%;
margin-top: 10px;box-shadow: 0 0 0 5px #DDEEFE;/*inset 0 2px 0 #60B2FB, 0 3px 0 5px #DDEEFE;*/
}
.cd-timeline-img img {
display: block;width: 24px;height: 24px;
position: relative;left: 50%;top: 50%;margin-left: -12px;margin-top: -12px;
}
.cd-timeline-img.cd-picture {
background: #60B3FC; margin-left: 17px;margin-top: 25px;
}
.cd-timeline-img.cd-movie {
background: #60B2FB; left: 21px;width: 10px;height: 10px;box-shadow:none;top:16px;
}
.cd-timeline-img.cd-location {
background: #f0ca45;
}
@media only screen and (min-width: 1170px) {
.cd-timeline-img {
width: 60px;height: 60px;left: 50%;margin-left: -30px;
/* Force Hardware Acceleration in WebKit */
-webkit-transform: translateZ(0);-webkit-backface-visibility: hidden;
}
.cssanimations .cd-timeline-img.is-hidden {
visibility: hidden;
}
.cssanimations .cd-timeline-img.bounce-in {
visibility: visible;-webkit-animation: cd-bounce-1 0.6s;
-moz-animation: cd-bounce-1 0.6s; animation: cd-bounce-1 0.6s;
}
}
.cd-timeline-content {
position: relative;margin-left: 50px;background: white;
border-radius:;padding: 0.4em;box-shadow: 0 1px 0 #d7e4ed;
}
.cd-timeline-content:after {
content: "";display: table;clear: both;
}
.cd-timeline-content h2 {
color: #303e49;
}
.cd-timeline-content p, .cd-timeline-content .cd-read-more, .cd-timeline-content .cd-date {
font-size: 13px;font-size: 0.8125rem;
}
.cd-timeline-content .cd-read-more, .cd-timeline-content .cd-date {
display: inline-block;
}
.cd-timeline-content p {
margin: 1em 0;line-height: 1.6;
}
.cd-timeline-content .cd-read-more {
float: right;padding: .8em 1em;
background: #acb7c0;color: white;border-radius: 0.25em;
}
.no-touch .cd-timeline-content .cd-read-more:hover {
background-color: #bac4cb;
}
a.cd-read-more:hover{text-decoration:none; background-color: #424242; }
.cd-timeline-content .cd-date {
float: left;padding: .4em 0;color: #A3A3A3;
}
.cd-timeline-content::before {
content: '';position: absolute;top: 9px;right: 100%;height:;width:;
border: 7px solid transparent;border-right: 7px solid white;
}
@media only screen and (min-width: 768px) {
.cd-timeline-content h2 {
font-size: 20px;font-size: 1.25rem;
}
.cd-timeline-content p {
font-size: 16px;font-size: 1rem;
}
.cd-timeline-content .cd-read-more, .cd-timeline-content .cd-date {
font-size: 14px;font-size: 0.875rem;
}
}
@media only screen and (min-width: 1170px) {
.cd-timeline-content {
margin-left:;padding: 1.6em; width: 45%;
}
.cd-timeline-content::before {
top: 24px;left: 100%;border-color: transparent;border-left-color: white;
}
.cd-timeline-content .cd-read-more {
float: left;
}
.cd-timeline-content .cd-date {
position: absolute;width: 100%;left: 122%;top: 6px;font-size: 16px;font-size: 1rem;
}
.cd-timeline-block:nth-child(even) .cd-timeline-content {
float: right;
}
.cd-timeline-block:nth-child(even) .cd-timeline-content::before {
top: 24px;left: auto;right: 100%;border-color: transparent;border-right-color: white;
}
.cd-timeline-block:nth-child(even) .cd-timeline-content .cd-read-more {
float: right;
}
.cd-timeline-block:nth-child(even) .cd-timeline-content .cd-date {
left: auto;right: 122%;text-align: right;
}
.cssanimations .cd-timeline-content.is-hidden {
visibility: hidden;
}
.cssanimations .cd-timeline-content.bounce-in {
visibility: visible;-webkit-animation: cd-bounce-2 0.6s;
-moz-animation: cd-bounce-2 0.6s;animation: cd-bounce-2 0.6s;
}
}
@media only screen and (min-width: 1170px) {
/* inverse bounce effect on even content blocks */
.cssanimations .cd-timeline-block:nth-child(even) .cd-timeline-content.bounce-in {
-webkit-animation: cd-bounce-2-inverse 0.6s;
-moz-animation: cd-bounce-2-inverse 0.6s; animation: cd-bounce-2-inverse 0.6s;
}
}
.cd-timeline-content div{height: 21px;line-height: 21px;}
.cd-timeline-content div:first-child{
color: #6DB6FE;font-size: 14px;line-height: 25px;
}
.cd-timeline-content div:last-child{line-height: 18px;}
/*为空*/
.empty-container{text-align:center;padding: 30% 0;background-color:#F5F5F5;overflow:hidden;height: 100%;position: fixed;width: 100%;}
.nodata-info{color:#C7C3C2;}
.nodata-icon{color:#C7C3C2;margin-top:25px;}
.nodata-icon .mui-icon{font-size:120px;}

我这里原来是使用了vue.js,理论上支持N个时间节点,原代码如下:

<div id="app" class="mui-content" style="background-color: #FFFFFF;">
<div v-show="isEmptyData" class="empty-container" v-cloak>
<div class="nodata-info">暂无相关内容</div>
<div class="nodata-icon"><span class="mui-icon iconfont icon-wuneirong"></span></div>
</div>
<section v-show="list.length>0" id="cd-timeline" class="cd-container" v-cloak>
<div v-for="(item,index) in list" class="cd-timeline-block">
<div class="cd-timeline-img" v-bind:class="[index==0?'cd-picture':'cd-movie']"></div>
<div class="cd-timeline-content">
<div v-text="item.text"></div>
<div class="cd-date" v-text="item.t"></div>
</div>
</div>
</section>
</div>

js代码:

            var vm = new Vue({
el: '#app',
data: {
isEmptyData:false,
list: []
},
mounted: function () {
mui.init();
this.list = [{ "text": "用户4,工单结束", "t": "2018-05-22 14:33:58" }, { "text": "用户4,工作人员到场签到", "t": "2018-05-22 14:33:44" },
{ "text": "用户4,分配工作人员", "t": "2018-05-22 14:33:34" }, { "text": "用户4,提交报修单", "t": "2018-05-21 18:06:44" }];
}});

MUI是非常轻量级的移动前端框架,而vue.js也是极简而优雅的mvvm框架,所以他们两合在一起使用实在是太方便了,不过他们两一起使用的同时会存在许多坑,若要避开这些坑,你需要知道MUI和vue.js他们的运行机制,其实也就是Dom操作、mui的生命周期同数据驱动、vue.js生命周期它们之间区别。

webstorm 2018 激活破解方法大全

HTML5 & MUI 界面样式的更多相关文章

  1. BCG界面库下的Windows8 UI界面样式www.webui8.com

    BCG界面库下的Windows8 UI界面样式(Metro风格)控件主要有以下一些功能: 规则的大块磁贴 支持完整键盘导航 Tile组 标题(Caption) 标题按钮(Caption buttons ...

  2. html5 表单样式 表单验证1 2 3

    html5 表单样式 ie9以下不支持 <!DOCTYPE html> <html lang="en"> <head> <meta cha ...

  3. Qt 之 模仿 QQ登陆界面——样式篇

    一.简述 今天晚上花了半天时间从QQ登录界面抠了些图,顺便加了点样式基本上实现了QQ的登陆界面全部效果.虽不说100%相似,那也有99.99%相似了哈O(∩_∩)O. QQ好像从去年开始,登录界面有了 ...

  4. webform登陆界面样式丢失

    本文摘抄自:http://blog.csdn.net/sssix/article/details/16945347 请阅读原文. Forms验证——登录界面样式实效? <authenticati ...

  5. mui.toast样式风格及位置修改教程

    mui.toast样式风格及位置修改教程 使用了mui.toast来实现可自动消失的信息提示效果. 但默认的显示效果太差了,很不显示,而且是在底部的. 如下图: 想改到屏幕的中间位置,再改大一点. 但 ...

  6. H5-Mui框架——修改mui.confirm样式

    问题简述: 使用mui框架默认提示框时,感觉与整体布局不符,因此想要更改其中的样式. 首先,查了一下资料:mui.toast样式风格及位置修改教程 以下是转载过来的文章内容. ============ ...

  7. HTML5+MUI+HBuilder 之初探情人

    07,08年那会儿正当Java火爆,C/C++仍是广泛运用的一门语言的时候,所以 我的大学都献给了C/C++和Java.当诺基亚的倒闭成为按键机时代衰落的标志时,移动APP的开发也如破堤之洪,爆炸式的 ...

  8. 移动Web界面样式-CSS3

    CSS2.1发布至今已经有7年的历史,在这7年里,互联网的发展 已经发生了翻天覆地的变化.CSS2.1有时候难以满足快速提高性能.提升用户体验的Web应用的需求.CSS3标准的出现就是增强CSS2.1 ...

  9. Html5+Mui前端框架,开发记录(三):七牛云 上传图片

    1.Html界面: <div id="container"> <label>凭证:</label> <div id="uploa ...

随机推荐

  1. C++实现二叉树

    #include <iostream> using namespace std ; class Tree { public : int number ; class Tree *left ...

  2. SharePoint 开发TimerJob 介绍

    项目需要写TimerJob,以前也大概知道原理,不过,开发过程中,还是遇到一些问题,网上看了好多博客,也有写的灰常好的,不过,自己还是想再写一下,也算是给自己一个总结,也算给大家多一个参考吧. Tim ...

  3. ruby TkPackage can't find package BWidget 之解决办法

    一个特别短的ruby/tk代码: require 'tkextlib\iwidgets' require 'tkextlib\bwidget' x = 0 101.times {|i| x+=i} T ...

  4. JS基础:基于原型的对象系统

    简介: 仅从设计模式的角度讲,如果我们想要创建一个对象,一种方法是先指定它的类型,然后通过这个类来创建对象,例如传统的面向对象编程语言 "C++"."Java" ...

  5. Mysql系列-数据库

    一 .数据库管理软件的由来 基于我们之前所学,数据要想永久保存,都是保存于文件中,毫无疑问,一个文件仅仅只能存在于某一台机器上. 如果我们暂且忽略直接基于文件来存取数据的效率问题,并且假设程序所有的组 ...

  6. spirng底层实现原理

    什么是框架?框架解决的是什么问题? 编程有一个准则,Don't Repeat Yourself(不要重复你的代码),所以我们会将重复的代码抽取出来,封装到方法中:如果封装的方法过多,将将这些方法封装成 ...

  7. activeMq的入门程序

    生产者 1.导入相关依赖 2.交给Spring管理,写入相关配置JmsTemplate @RunWith(SpringJUnit4ClassRunner.class) @ContextConfigur ...

  8. Ubuntu编译安装crtmp-server

    下载源码 从GitHub上下载:https://github.com/j0sh/crtmpserver.git 编译安装 apt-get install cmake apt-get install l ...

  9. 用户注册登录系统 V2.0

    # 准备空列表 users = [] # 准备当前在线用户 online_user = {} while True: # 打印系统提示 print("欢迎使用 用户注册登录系统V2.0&qu ...

  10. 报错:严重: Servlet.service() for servlet [springmvc] in context with path [ ] threw exception [Request processing failed; nested exception is java.lang.NullPointerException] with root cause

    解决:service类或dao类需要@Autowired