界面展示:
代码:
第一步,引入相关样式:(注意:还需要引入对应的iconfont2.ttf)
<link href="css/mui.css" rel="stylesheet" />
<link href="css/home.css" rel="stylesheet" />
<link href="css/common.css" rel="stylesheet" />
<link rel="stylesheet" href="css/iconfont2.css">
第二步:body内输入图标代码
<!-- 标题栏mheader -->
<header class="mui-bar mui-bar-nav top-bar">
<!-- 语音搜索框minput -->
<div class="mui-input-row mui-search">
<input type="search" class="mui-input-speech mui-input-clear" placeholder="手机充值">
</div>
<!-- 添加 -->
<a href="#">
<span class="mui-icon icon iconfont icon-tianjia"></span>
</a>
<!-- 朋友 -->
<a href="#">
<span class="mui-icon icon iconfont icon-pengyou"></span>
</a>
</header>
第三步:编辑home.css样式,调整顶栏组件格式
/* 将hmoe.html在浏览器中运行,接着使用F12查看控制其样式的类,并在此进行修改 */
/* 控制搜索框的宽度 */
.mui-search{
width: 70%;
float: left;
}
/* 控制搜索框的上下位置 */
.mui-bar input[type='search']{
margin:8px 0;
}
/* 控制搜索框内搜索图标的颜色和位置 */
.mui-search .mui-placeholder .mui-icon{
color:white!important;
float:left;
margin:2px 0;
}
/* 控制搜索框内"手机充值"的样式 */
.mui-search .mui-placeholder{
text-align:left;
color:white;
font-size:12px;
line-height: 44px;
}
/* 语音图标样式 */
.mui-icon-speech{
font-size:20px!important;
line-height: 25px;
color:white!important;
}
/* 设置搜索框外的俩超链接图标样式 */
.top-bar a{
width:35px!important;
height:50px!important;
float:right!important;
line-height: 50px;
margin-left:5px;
}
.top-bar a span{
display: block!important;
height: 50px!important;
color:white!important;
font-size:25px!important;
}
第四步:阿里巴巴矢量图标的样式控制iconfont2.css
@font-face {
font-family: "iconfont"; /* Project id */
src: url('../fonts/iconfont2.ttf?t=1649660095085') format('truetype');
}
.iconfont {
font-family: "iconfont" !important;
font-size: 16px;
font-style: normal;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
}
/* 添加 */
.icon-tianjia:before {
content: "\e622";
}
/* 朋友 */
.icon-pengyou:before {
content: "\e61a";
}
相关链接
1、MUI的简介
2、MUI的字体图标
3、MUI的事件处理
4、HbuilderX中新建MUI下的移动端App
5、H5+ Webview窗口对象
6、MUI-底栏实现-页面切换
7、MUI-标题栏实现-样式复写效果
8、MUI-栅格系统-实现元素排版
9、MUI-列表实现
10、MUI-列表实现2
11、MUI-轮播插件实现-UI组件
12、MUI-弹出菜单
13、MUI-页面刷新
14、MUI-新建子页面
15、MUI-页面之间传值(打开新的子页面)
16、HTML5+规范API-拍照功能
17、HTML5+规范API-系统相册获取功能
18、HTML5+规范API-地理位置获取
19、MUI-上拉刷新和下拉刷新
20、HTML5+规范API-扫码功能
21、HTML5+规范API-系统通讯录获取功能
22、Hbuilder无法完成应用程序云打包,一直报错需要打包校验
23、Hbuilder-应用程序打包
24、移动APP开发的三种常见模式
25、IOS系统测试APP时发现input内无法选中并输入值
26、MUI-购物车