如何在我的图像中对齐以将其垂直向上移动?(CSS、HTML)?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/8090195/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-29 11:27:50  来源:igfitidea点击:

How do I align in my image to move it vertically up?(CSS,HTML)?

htmlcss

提问by KeenUser

A basic CSS/HTML question. As shown in my screenshot, there is an image of an arrow in the left, I want to move it in such a way that the mid point of the arrow is slightly above the mid point of the text following that. Probably this is basic stuff, but what property in css will help me do that?

一个基本的 CSS/HTML 问题。如我的屏幕截图所示,左侧有一个箭头图像,我想以这样的方式移动它,即箭头的中点略高于其后文本的中点。可能这是基本的东西,但是 css 中的哪些属性可以帮助我做到这一点?

I have a css class for the image something like this.

我有一个类似这样的图像的 css 类。

<img src="images/block_arrow.png" class="t-image imagestyle1" alt="image"/>

Thanks,Adarsh

谢谢,阿达什

Screenshot

截屏

回答by alt

Add following css..

添加以下css..

.t-image {
    position: relative /* Declared position allows for location changes */
    top: -2px; /* Moves the image 2px closer to the top of the page */
}