---
title: "How to verticly align an object"  
description: "How to verticly align an object"  
author: "Anurag Sharma"  
published: 2015-06-01  
updated: 2015-06-01  
canonical: https://www.mindstick.com/forum/23273/how-to-verticly-align-an-object  
category: ".net"  
tags: ["c#", "asp.net"]  
reading_time: 2 minutes  

---

# How to verticly align an object

I'm using a [table](https://www.mindstick.com/articles/43918/how-to-design-table-using-bootstrap) which contains an H3 inside. Inside that H3 there is a [google search](https://www.mindstick.com/articles/12393/google-search-adds-new-personal-tab-to-showcase-only-your-content-results) bar. [Now](https://yourviews.mindstick.com/view/81402/it-s-liberals-vs-progressives-in-us-politics-now) the google [search bar](https://www.mindstick.com/forum/315/how-to-achieve-similar-google-search-bar-functionality-in-c) is alligned at the top of the H3. How can I vertically allign it so it's centered? This is what I have at the moment:

```
<table>  <tr><td id="Vak1.3"><h3>                        <script type="">                                                    (function () {                                                        var cx = '013446364428343597193:qtxsarco2zs';                                                        var gcse = document.createElement('script');                                                        gcse.type = 'text/javascript';                                                        gcse.async = true;                                                        gcse.src = (document.location.protocol == 'https:' ? 'https:' : 'http:') +                                '//www.google.com/cse/cse.js?cx=' + cx;                                                        var s = document.getElementsByTagName('script')[0];                                                        s.parentNode.insertBefore(gcse, s);                                                    })();                        </script>                        <gcse:search></gcse:search>        </h3></td>    </tr>  </table>
```

## Replies

### Reply by Anonymous User

Generally spoken, its no longer a good practice to design a website with a table. This doesn't mean that tables are bad in general. That said you could put your searchbar into a div:

<div id="container">your searchbar here..</div>

That div can be vertically (and horizontally) aligned easily with:

```
#container { position: absolute;top: 0;right: 0;bottom: 0;left: 0;margin: auto;    }
```

If you want to have only vertical alignment you can change:

margin-top: auto;

margin-bottom: auto;

But be patient that position: absolute is always related to the next parent element, which got the position element.


---

Original Source: https://www.mindstick.com/forum/23273/how-to-verticly-align-an-object

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
