CSS实现垂直居中的5种方法(6)
作者:糖伴西红柿 来源:前端观察 发布时间:2009-03-04 12:53:00
哪个方法?
我最喜欢的是方法三,缺点不多。因为 content 会清除浮动,所以可以在它上面放置别的元素,并且当窗口缩放时,
居中的 content 不会把另外的元素盖住。看例子。
<div id="top"><h1>Title</h1></div><div id="content"> Content Here</div>
#floater {float:left; height:50%; margin-bottom:-120px;}#top {float:right; width:100%; text-align:center;}#content {clear:both; height:240px; position:relative;}
现在你知道是怎么回事了,现在我们开始创建一个简单但是有趣的网站。最终的样子是这样的:
步骤一
以语义化标签开始是很好的。下面是我们的页面构成:
#floater/*把 content 置中*/#contred/*centre 盒*/#side#logo#nav/*无序列表*/#content#bottom/*放置版权等*/
这是我用到的 xhtml 代码:
A Centred Company<div id="centered"><div id="side"><div id="logo"> <strong><span>A</span> Company</strong></div><ul id="nav"> <li><a href="#">Home</a></li> <li><a href="#">Products</a></li> <li><a href="#">Blog</a></li> <li><a href="#">Contact</a></li> <li><a href="#">About</a></li></ul></div><div id="content"><h1>Page Title</h1>Holisticly re-engineer value-added outsourcing after process-centric collaboration and idea-sharing. Energistically simplify impactful niche markets via enabled imperatives. Holisticly predominate premium innovation after compelling scenarios. Seamlessly recaptiualize high standards in human capital with leading-edge manufactured products. Distinctively syndicate standards compliant schemas before robust vortals. Uniquely recaptiualize leveraged web-readiness vis-a-vis out-of-the-box information.<h2>Heading 2</h2>Efficiently embrace customized web-readiness rather than customer directed processes. Assertively grow cross-platform imperatives vis-a-vis proactive technologies. Conveniently empower multidisciplinary meta-services without enterprise-wide interfaces. Conveniently streamline competitive strategic theme areas with focused e-markets. Phosfluorescently syndicate world-class communities vis-a-vis value-added markets. Appropriately reinvent holistic services before robust e-services.</div></div><div id="bottom"> Copyright notice goes here</div>


猜你喜欢
- 1.remove: 删除单个元素,删除首个符合条件的元素,按值删除,从左向右依次删除符合条件的值举例说明:>>> str=
- cos()方法返回x弧度的余弦值。语法以下是cos()方法的语法:cos(x)注意:此函数是无法直接访问的,所以我们需要导入ma
- 需要先安装 tabulate 模块:pip3 install tabulate以上是把一维的dict打印出来.再看看二维的,list-of-
- Onunload,onbeforeunload都是在刷新或关闭时调用,可以在<script>脚本中通过window.onunlo
- 需要在两个文件中实现:首先,在talker.asp(在线名单)中做如下处理:<%p1=trim(application("v
- 简介这个模块处理python中常见类型数据和Python bytes之间转换。这可用于处理存储在文件或网络连接中的bytes数据以及其他来源
- 1.Python hasattr() 函数描述hasattr() 函数用于判断对象是否包含对应的属性。语法hasattr 语法:hasatt
- 一、前言下述配置的前提是服务器上存在多个虚拟环境,且 PyCharm为专业版二、配置方法配置远程服务器配置多个解释器在配置好远程服务器后,依
- 在网上搜索Linux下安装MySQL的方法时,出现了很多的方法,但是很多的方法很复杂,而且还不一定成功,试了很久终于试验出一种简单的方法,下
- 很多初学者会使用windows作为开发机使用, 今天就来看下如何在win10和Linux下分别安装Python虚机环境。虚机环境有非常多的优
- 开发需求python 3.7+pygame 1.9+演示项目地址https://github.com/Mr-han11/PythonSupe
- 代码如下:<% '=================================================
- 注:所有文字,除注明网站类型外,其他均针对企业站点.请随时注意留言,若修改则会在首页提示文字里标注.若牵扯到业务方面的问题,我可能不会做过多
- 说下思路吧:原图->灰度->根据像素亮度-映射到指定的字符序列中->输出。字符越多,字符变化稠密。效果会更好。如果根据灰度
- declare @Table_name varchar(60) set @Table_name = 'Pay_inputpay
- 实例一:无参的存储过程$conn = mysql_connect('localhost','root',
- 工厂模式: “工厂”即表示一个负责创建其他类型的对象的类,通常情况下,一个工厂的对象会有一个或多个方法与之关联,这些方法用于创建不同类型的对
- 背景随着业务的发展,公司业务和规模不断扩大,网站积累了大量的用户信息和数据,对于一家互联网公司来说,用户和业务数据是根基。一旦公司的数据错乱
- ASP使用xmlhttp获取远程网页内容,解决乱码问题方法一:<%function getHTTPPage(url)on error
- text函数的功能是向数据点添加文本说明。语法text(x,y,txt)text(x,y,z,txt)text(___,Name,Value