标签: web

  • 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>