css垂直居中代码

文字垂直居中代码

外层框设定高度height=行高line-height

图片居中

vertical-align:middle
<!doctype html>
<html>
	<head>
	<style>
		form{
			border:15px solid red;
			height:100px;
			text-align:center;
			padding:5px;
			line-height:100px;
		}
		div{
			height:500px;
			border:15px solid blue;
			line-height:500px;
			text-align:center;
		}
		div img{
			vertical-align:middle;
			}
	</style>
	
	</head>
	<body>
		<form>
			<input type="submit" value="提交">
			<input type="text" value="请输入文字">
		</form>
		<div>
			<img src="http://d.lanrentuku.com/down/png/1505/android-lollipop-icon-set-by-tinylab/goodreads.png">	
		</div>
	</body>
</html>

 

收藏夹

为什么最近有很多名人,比如比尔盖茨,马斯克、霍金等,让人们警惕人工智能?【转载】

2015-4-9 20:16:30

收藏夹

那句“教练我想打篮球”凭什么就成了经典【转载】

2016-9-20 8:53:36

0 条回复 A文章作者 M管理员
    暂无讨论,说说你的看法吧
个人中心
购物车
优惠劵
有新私信 私信列表
搜索