Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

html

css

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?

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

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

Thanks,Adarsh

Screenshot

like image 275
KeenUser Avatar asked Nov 11 '11 05:11

KeenUser


People also ask

How do I align an image vertically in HTML?

To center an image vertically, you can wrap it in a block element like a div and use a combination of the CSS position property, the left and top properties, and the transform property.

How do you vertically align an object in CSS?

To center both vertically and horizontally, use padding and text-align: center : I am vertically and horizontally centered.

How do I align vertically in HTML?

For example, if you're trying to align something horizontally OR vertically, it's not that difficult. You can just set text-align to center for an inline element, and margin: 0 auto would do it for a block-level element.


1 Answers

Add following css..

.t-image {
    position: relative /* Declared position allows for location changes */
    top: -2px; /* Moves the image 2px closer to the top of the page */
}
like image 127
alt Avatar answered Sep 28 '22 15:09

alt