[英]Center vertical image on top image
from some helped from others in stackoverflow i already horizontal my text on image. 在stackoverflow中,一些人的帮助下,我已经在图像上水平放置了文本。 Right now i want the text at center on vertical also. 现在,我也要在垂直居中对齐文本。 Thank you very guys 谢谢你们
<body>
<div class="images">
<img src="image.jpg" id="imageid" />
<div class="texts" id="text">
<a href="#">Gallery 1</a>
</div>
</div>
.images {
position:relative;
text-align:center;
float: left;
}
.texts {
left: 0;
position:absolute;
width: 100%;
}
You can take a look into this explanatory site http://css-tricks.com/what-is-vertical-align/ 您可以浏览此说明性网站http://css-tricks.com/what-is-vertical-align/
You can use vertical-align:middle
property to align the image to the text. 您可以使用vertical-align:middle
属性将图像与文本对齐。
Here is a sample http://www.w3schools.com/cssref/tryit.asp?filename=trycss_vertical-align 这是一个示例http://www.w3schools.com/cssref/tryit.asp?filename=trycss_vertical-align
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.