图像的垂直和水平对准 [英] Vertical and horizontal align of image

查看:372
本文介绍了图像的垂直和水平对准的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个占位符(在建)网站,仅保留一个具有标志形象。 0汽车:我horizo​​ntically与边缘排列。 但我怎么知道另外的水平对齐图像。 或者用一句:我如何完全滤清图片

I have a placeholder (under construction) site which holds only one image with the logo. I horizontically aligned with margin: 0 auto. But how do I know additionally horizontal align the image. Or with one sentence: How do I fully centrate an image.

看这里看直播:小提琴

问候, 博德

编辑: 为1:2(高度与宽度)图像用:

For 1:2 (height to width) images use:

#wrapper img
{
    position: absolute;
    top: 50%;
    left: 50%;
    width: 799px;
    height: 404px;
    margin: -202px -399px 0;
    border: 1px solid black;
}

像在链接的主题:)

like in the linked thread :)

感谢您的帮助

推荐答案

URM ..你有没有试过?

Urm.. Have you tried ?

<div class='placeholder'>
   <img src='../images/myimage'>
</div>

和的CSS,该标记

.placeholder
{
position : absolute;
top : 50%;
left : 50%;
width : 200px; /* Width of the image in question */
height : 200px;/* height of the image in question */
margin : -100px 0px 0px -100px;
}

这应该把你的图像与页面的中心。

This should bring your image to the very center of the page.

这篇关于图像的垂直和水平对准的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆