how to center stuff inside a link?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • gamer2d
    New Member
    • Jul 2014
    • 10

    #1

    how to center stuff inside a link?

    Take a look at the attached image to see what I am trying to do. There will be two images. Images1 is what I want. Image 2 is what my code does.

    The issue is the stuff inside link are not center.

    Code:
    <div id="table">
        <table>
            <tr bgcolor="#FFFFFF">
                <td>
                    <a href="google.com">
                        <img src="Images/google.png"  />
                        <span>google</span>
                    </a>
                </td>
            </tr>
        </table>
    </div>

    Code:
    #table table
    {
        color: blue;
        font-weight: bold;
        width: 100%;
    }
    
    #table table tr td
    {
       border: 1px solid black;
       text-align: center;
       height: 100px;
    }
    
    #table table tr td:hover
    {
        background-color: red;
    }
    
    #table table tr td img
    {
        width: 50px;
        height: 50px;
        float: left;
        padding-left:15px;
    
    }
    
    #table table tr td a
    {
        display: block;
        height: 100%;
    }
    
    
    #table table tr td a span
    {
    
    }
    Attached Files
  • computerfox
    Contributor
    • Mar 2010
    • 276

    #2
    Normally when using a table, you can center-align by using
    Code:
    vertical-align:center
    and
    Code:
    *vertical-align:center;
    The vertical-align property sets the vertical alignment of an element.

    Comment

    Working...