text-align center is not working inside inline-block html table

nathanaric

I am making an HTML Email and have decided to use tables for each of the nav elements. I need the tables to be displayed inline. I used display:inline-block; on the table creating the desired result, However the TEXT inside the table will not align. I have placed the text-align: center; in the table, td, and a tag but it has not worked.

I know the method works with divs but I can't find a solution for tables.

HTML

<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
    <td align="right" valign="top">

        <table class="navInline" width="130" height="35" border="0" cellspacing="0" cellpadding="0" bgcolor="#999966" style="text-align:center;">
            <tr>
                <td align="center"> <a href="#" style="text-decoration: none; color: #005E82;">
     option 1
     </a>

                </td>
            </tr>
        </table>

        <table class="navInline" width="130" height="35" border="0" cellspacing="0" cellpadding="0" bgcolor="#999966">
            <tr>
                <td align="center" style="text-align:center;"> <a href="#" style="text-decoration: none; color: #005E82;">
     option 2
                    </a>

                </td>
            </tr>
        </table>

        <table class="navInline" width="130" height="35" border="0" cellspacing="0" cellpadding="0" bgcolor="#999966">
            <tr>
                <td align="center"> <a href="#" style="text-decoration: none; color: #005E82; text-align:center;">
     option 3
     </a>

                </td>
            </tr>
        </table>
    </td>
</tr>

CSS

.navInline {
display:inline-block;
vertical-align:top;
text-align: center !important; }

here is the not working code

http://jsfiddle.net/nathanaric/pf35h/9/

John Rooney

You need to set a width attribute on your table cells.

Example:

<table class="navInline" width="130" height="35" border="0" cellspacing="0" cellpadding="0" bgcolor="#999966" style="text-align:center;">
  <tr>
    <td align="center" width="130"><a href="#" style="text-decoration: none; color: #005E82;">option 1</a></td>
  </tr>

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

text align center not working for inline-block

From Dev

Vertical align span text inside inline-block div

From Dev

Text-align :center not working even after setting display:block

From Dev

Text-align :center not working even after setting display:block

From Dev

text align center not working

From Dev

text align center not working

From Dev

inline-block align with text

From Dev

HTML5 How to align a table to center inside a form?

From Dev

Align a div vertically inside an inline-block

From Dev

align text center not working as expected

From Dev

text-align :center not working

From Dev

text-align: center; not working

From Dev

Vertical align not working on inline-block

From Dev

CSS vertical align of inline-block not working

From Dev

html css outer div text align center, inside div text align left

From Dev

Why inline-block is not working to align two divs inside of a parent container div horizontally side by side?

From Dev

Why inline-block is not working to align two divs inside of a parent container div horizontally side by side?

From Dev

<img align="center" not working HTML

From Dev

Vertically align text to middle of inline-block

From Dev

Vertically align a text inside a inline-block spine with parent container height in percentage

From Dev

Align two inline-block elements inside table-cell to opposite sides

From Dev

How to center align two inline images in HTML

From Dev

Aligning text to the left, middle, right using span, text align, and inline-block, CSS, HTML

From Dev

HTML align inline-block horizontally?

From Dev

Vertical align center not working inside Bootstrap container

From Dev

Center align inline-block div with another div floated left of it

From Dev

How to get text align center with block but align left?

From Dev

Center align text inside a element in a flex row

From Dev

Vertical align text with a link inside a div block

Related Related

  1. 1

    text align center not working for inline-block

  2. 2

    Vertical align span text inside inline-block div

  3. 3

    Text-align :center not working even after setting display:block

  4. 4

    Text-align :center not working even after setting display:block

  5. 5

    text align center not working

  6. 6

    text align center not working

  7. 7

    inline-block align with text

  8. 8

    HTML5 How to align a table to center inside a form?

  9. 9

    Align a div vertically inside an inline-block

  10. 10

    align text center not working as expected

  11. 11

    text-align :center not working

  12. 12

    text-align: center; not working

  13. 13

    Vertical align not working on inline-block

  14. 14

    CSS vertical align of inline-block not working

  15. 15

    html css outer div text align center, inside div text align left

  16. 16

    Why inline-block is not working to align two divs inside of a parent container div horizontally side by side?

  17. 17

    Why inline-block is not working to align two divs inside of a parent container div horizontally side by side?

  18. 18

    <img align="center" not working HTML

  19. 19

    Vertically align text to middle of inline-block

  20. 20

    Vertically align a text inside a inline-block spine with parent container height in percentage

  21. 21

    Align two inline-block elements inside table-cell to opposite sides

  22. 22

    How to center align two inline images in HTML

  23. 23

    Aligning text to the left, middle, right using span, text align, and inline-block, CSS, HTML

  24. 24

    HTML align inline-block horizontally?

  25. 25

    Vertical align center not working inside Bootstrap container

  26. 26

    Center align inline-block div with another div floated left of it

  27. 27

    How to get text align center with block but align left?

  28. 28

    Center align text inside a element in a flex row

  29. 29

    Vertical align text with a link inside a div block

HotTag

Archive