---
title: "Vertically align text next to an image in jQuery."  
description: "Vertically align text next to an image in jQuery."  
author: "Utpal Vishwas"  
published: 2023-09-27  
updated: 2023-10-05  
canonical: https://www.mindstick.com/forum/159944/vertically-align-text-next-to-an-image-in-jquery  
category: "jquery"  
tags: ["jquery", "jquery ui"]  
reading_time: 2 minutes  

---

# Vertically align text next to an image in jQuery.

[Vertically align](https://www.mindstick.com/forum/159390/how-do-i-vertically-align-text-in-a-div-please-provide-sample) [text](https://www.mindstick.com/blog/301635/did-people-reinvent-texting-to-express-the-full-range-of-emotions) next to an [image](https://www.mindstick.com/articles/23551/an-investigate-distinctive-seafood-restaurant-for-your-image-stamp-character) in jQuery.

## Replies

### Reply by Aryan Kumar

To vertically align text next to an image using jQuery, you can manipulate the CSS properties of the elements containing the text and image. Here's an example of how you can achieve vertical alignment:

HTML Structure:

```plaintext
<div class="container">
  <img src="your-image-url.jpg" alt="Image">
  <p class="text">Your text goes here.</p>
</div>
```

CSS:

```plaintext
.container {
  display: flex; /* Use flexbox for vertical alignment */
  align-items: center; /* Vertically center items */
}

.text {
  margin-left: 10px; /* Add margin to create space between image and text */
}
```

JavaScript (jQuery):

```plaintext
$(document).ready(function () {
  // Your jQuery code here (if needed)
});
```

In this example:

1. We have a container **<div>** that wraps both the image and the text.
2. We use CSS to set the container to **display: flex;** and **align-items: center;**. This centers the items vertically within the container.
3. We add a margin to the text element to create space between the image and the text.

You can adjust the CSS properties, such as **margin-left**, to control the spacing between the image and the text according to your design preferences.


---

Original Source: https://www.mindstick.com/forum/159944/vertically-align-text-next-to-an-image-in-jquery

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
