首页
产品
快图
小程序
微商城
网站建设
新闻
公司动态
行业资讯
关于
案例
联系
应用position:fixed特性让DIV垂直居中
2021-01-20 11:22
jianzhan
先看1下实际效果
:
http://www.keleyi.com/keleyi/phtml/fixedcenter.htm
重要编码是
:#topmenu_keleyi_com{position:fixed;left:0px;right:0px;width:706px;margin-left:auto;margin-right:auto;}
附详细编码
:
拷贝编码
编码以下:
<!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>
<title>使position:fixed的DIV垂直居中-柯乐义</title>
<style type="text/css">
#topmenu_keleyi_com{position:fixed;left:0px;right:0px;width:706px;margin-left:auto;margin-right:auto;top:100px;height:50px;background-color:Red;}
#topmenu_keleyi_com li{float:left;
list-style:none;
margin-right:1px;
width:116px;
background-color:#e0f0e0;
}
#topmenu_keleyi_com ul{ margin:0px;padding:0px;}
body{margin:0px;}
</style>
</head>
<body>
<div id="topmenu_keleyi_com">
<ul><li><a href="http://www.keleyi.com/menu/net/" target="_blank">.NET</a></li>
<li><a href="http://www.keleyi.com/menu/javascript/" target="_blank">Javascript</a></li>
<li><a href="http://www.keleyi.com/menu/jquery/" target="_blank">jQuery</a></li>
<li><a href="http://www.keleyi.com/menu/csharp/" target="_blank">C#</a></li>
<li><a href="http://www.keleyi.com/menu/other/" target="_blank">别的</a></li>
<li><a href="http://www.keleyi.com/" target="_blank">主页</a></li></ul>
position:fixed的DIV的垂直居中实际效果,更改网页页面的宽度看看。
</div>
</body>
</html>
为您推荐
应用position:fixed特性让DIV垂直居中
并排的两个目标怎样水平对齐适配ie6
Css基础定义及其引进方法详细介绍
css expression应用简述及其优缺陷详细介绍
css中有关精准定位特性position为fixed的应用
所有文章
公司动态
行业资讯