LI 导航
HTML:
<div class="my_nav">
<ul>
<li class="tiao cur" id="order_tab_1"><a href="#">待付款</a></li>
<li class="tiao " id="order_tab_2"><a href="#">待收货/提货</a></li>
<li class="tiao " id="order_tab_3"><a href="#">全部订单</a></li>
</ul>
</div>
Css:
.my_nav {
width: 100%;
border: 1px solid #e0e0e0;
border-width: 1px 0;
background-color: #fff;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}
.my_nav ul {
display: box;
display: -ms-box;
display: -webkit-box;
display: flex;
display: -ms-flexbox;
display: -webkit-flex;
overflow: hidden;
}
.my_nav li.cur {
background-color: #E5E5E5;
}
.my_nav li:first-child {
border-left: 0;
}
.my_nav li {
display: block;
flex: 1;
-ms-flex: 1;
-webkit-flex: 1;
box-flex: 1;
-ms-box-flex: 1;
-webkit-box-flex: 1;
width: 100px;
text-align: center;
font-size: 12px;
line-height: 36px;
border-left: 1px solid #e0e0e0;
padding: 0px;
background-color: #f3f3f3;
}
.my_nav a {
display: block;
min-height: 36px;
}
a {
border-bottom-color: #cccccc;
border-bottom-style: none;
COLOR: #888888;
text-decoration: none;
font-family: "Microsoft Yahei",Arial, Helvetica, sans-serif;
outline: none;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta content="width=device-width, initial-scale=1, user-scalable=no, minimal-ui" name="viewport">
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta content="telphone=no" name="format-detection">
<title>等分居中</title>
<link media="all" href="http://www.w3cplus.com/mcommon/reset.css" rel="stylesheet">
<style type="text/css">
.demo{
line-height:44px;
margin-bottom: 20px;
text-align: center;
background-color: #0078e7;
color: #fff;
} .flex-equal,.flex-center, .justify {
display: -webkit-box;
display: -ms-flexbox;
display: -webkit-flex;
display: flex;
} .flex-equal li {
-webkit-box-flex: ;
-ms-flex: ;
-webkit-flex: ;
flex: ;
} .table-equal {
display: table;
table-layout: fixed;
width: %;
}
.table-equal li {
display: table-cell;
}
.demo-center{
border: 1px solid #ccc;
margin:20px;
height:200px;
}
.demo-center .children{
background: #0078e7;
color: #fff;
width:150px;
line-height:;
text-align:center;
}
.flex-center {
-webkit-box-pack: center;
-ms-flex-pack: center;
-webkit-justify-content: center;
justify-content: center;
-webkit-box-align: center;
-ms-flex-align: center;
-webkit-align-items: center;
align-items: center;
} .translate-center{
position: relative;
} .translate-center .children{
position: absolute;
top: %;
left: %;
-webkit-transform: translate(-%, -%);
transform: translate(-%, -%);
}
.justify {
-webkit-box-pack: justify;
-ms-flex-pack: justify;
-webkit-justify-content: space-between;
justify-content: space-between;
padding: 10px;
background: #0078e7;
color:#fff;
line-height: 32px;
}
</style>
</head>
<body>
<h2>flex等分</h2>
<ul class="flex-equal demo">
<li>手机</li>
<li>联系人</li>
<li>信息</li>
<li>主屏</li>
</ul> <ul class="flex-equal demo">
<li>手机</li>
<li>联系人</li>
<li>信息</li>
</ul>
<h2>table等分</h2>
<ul class="table-equal demo">
<li>手机</li>
<li>联系人</li>
<li>信息</li>
<li>主屏</li>
</ul>
<ul class="table-equal demo">
<li>手机</li>
<li>联系人</li>
<li>信息</li>
</ul>
<h2>flex居中</h2>
<div class="flex-center demo-center">
<div class="children">子元素水平垂直居中</div>
</div>
<h2>translate居中</h2>
<div class="translate-center demo-center">
<div class="children">子元素水平垂直居中</div>
</div>
<h2>两端对齐</h2>
<div class="justify"><h2>左边对齐</h2><span>右边对齐</span></div>
</body>
</html>
原文地址:http://www.cnblogs.com/xinlinux/p/4463608.html
LI 导航的更多相关文章
- 不可思议的纯CSS导航栏下划线跟随效果
先上张图,如何使用纯 CSS 制作如下效果? 在继续阅读下文之前,你可以先缓一缓.尝试思考一下上面的效果或者动手尝试一下,不借助 JS ,能否巧妙的实现上述效果. OK,继续.这个效果是我在业务开发的 ...
- 如何使用纯CSS制作特效导航条?
先上张图,如何使用纯 CSS 制作如下效果? 在继续阅读下文之前,你可以先缓一缓.尝试思考一下上面的效果或者动手尝试一下,不借助 JS ,能否巧妙的实现上述效果. OK,继续.这个效果是我在业务开发的 ...
- Bootstrap4 导航栏
Bootstrap4 导航栏 目录 Bootstrap4 导航栏 动态选项卡 标准的导航栏 导航对齐方式 导航栏的组成 ul 元素中包含navbar-nav 类 表示导航栏中ul li元素中包含nav ...
- [HTML/CSS]导航栏的下划线跟随效果
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8&quo ...
- navLI鼠标滑上显示下拉导航
<!DOCTYPE html><html> <head> <meta charset="UTF-8"> <title>l ...
- Bootstrap(7) 输入框和导航组件
一.输入框组件 文本输入框就是可以在<input>元素前后加上文字或按钮,可以实现对表单控件的扩展. //在左侧添加文字 <!-- //在左侧添加文字 --> ...
- 纯css导航栏下划线
.nav-underline > *{/* 指定容器,里面可以是li.span等多样化的元素 */ display: inline-block; margin: -3px; padding: 1 ...
- 奇妙的CSS3—导航栏下划线跟随效果
先来看一下效果: 1.基本效果就是这样的 ,鼠标悬停,下划线划入.鼠标离开,下划线划出 2.下划线的划入是有方向的,从左侧划入悬停,下划线由左向右伸长.从右侧划入,下划线由又往左伸长 实现思路 1.导 ...
- 纯css导航下划线跟随效果【转载】
css: ul { display: flex; position: absolute; width: 800px; top: 50%; left: 50%; transform: translate ...
随机推荐
- lightoj 1036 dp
题目链接:http://lightoj.com/volume_showproblem.php?problem=1036 #include <cstdio> #include <cst ...
- pecl/mongo is already installed
sw-engine-cgi PHP MongoDB database drivermongodb database driver,数据库驱动;
- Linux命令之hwclock - 查询和设置硬件时钟
常用参数 -r, --show 读取并打印硬件时钟(read hardware clock and print result ) -s, --hctosys 将硬件时钟同步到 ...
- Flash Stage3D 在2D UI 界面上显示3D模型问题完美解决
一直以来很多Stage3D开发者都在为3D模型在2DUI上显示的问题头疼.Stage3D一直是在 Stage2D下面.为了做到3D模型在2DUI上显示通常大家有几种实现方式,下面来说说这几种实现方式吧 ...
- 【Android - 框架】之ButterKnife的使用
ButterKnife可以省去控件findViewById的步骤,提高开发效率. 用法: 1.添加依赖: compile 'com.jakewharton:butterknife:5.1.1' 2.在 ...
- Java NIO类库Selector机制解析--转
一. 前言 自从J2SE 1.4版本以来,JDK发布了全新的I/O类库,简称NIO,其不但引入了全新的高效的I/O机制,同时,也引入了多路复用的异步模式.NIO的包中主要包含了这样几种抽象数据类型: ...
- tcmalloc资料
1. 确定dylib在max os是可以成功的. http://lists.apple.com/archives/perfoptimization-dev/2008/Dec/msg00002.html ...
- windows使用python调用wget批处理下载数据
wget是linux/unix下通常使用的下载http/ftp的数据,使用非常方便,其实wget目前经过编译,也可在windows下使用.最近需要下载大量的遥感数据,使用了python写了批处理下载程 ...
- poj1742 Coins(多重背包+单调队列优化)
/* 这题卡常数.... 二进制优化或者单调队列会被卡 必须+上个特判才能过QAQ 单调队列维护之前的钱数有几个能拼出来的 循环的时候以钱数为步长 如果队列超过c[i]就说明队头的不能再用了 拿出来 ...
- mvc form
当点击提交按钮后,想在Controll里取到Form里的数据. 必须在控件上设置name属性 例如<input type='text',name='userId'/>, 在controll ...