---
title: "Vertically align text in \"a\" tag element with CSS"  
description: "Vertically align text in \"a\" tag element with CSS"  
author: "Utpal Vishwas"  
published: 2023-04-25  
updated: 2023-04-26  
canonical: https://www.mindstick.com/forum/158007/vertically-align-text-in-a-tag-element-with-css  
category: "html"  
tags: ["html", "css", "css position"]  
reading_time: 1 minute  

---

# Vertically align text in "a" tag element with CSS

[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) in <a> element with [CSS](https://www.mindstick.com/forum/514/background-gradient-ie7-css-problem)

## Replies

### Reply by Aryan Kumar

You can vertically align text in an "a" tag element using CSS by setting the "line-height" property to be equal to the height of the element. Here's an example:

HTML:

```html
<a href="#">Click me</a>
```

CSS:

```css
a {
 display: inline-block;
 height: 50px;
 line-height: 50px;
 vertical-align: middle;
}
```

In the example above, we set the "display" property of the "a" tag element to "inline-block" so that we can set its height. We then set the "height" property to be the desired height of the element and the "line-height" property to be equal to the height. Finally, we set the "vertical-align" property to "middle" to align the text vertically in the middle of the element.


---

Original Source: https://www.mindstick.com/forum/158007/vertically-align-text-in-a-tag-element-with-css

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
