Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Apr 2003
    Location
    Seoul, Korea
    Posts
    329
    Thanks
    0
    Thanked 0 Times in 0 Posts

    alignment of inlin-block box

    Code:
    <style>
    
    a.box{  
    display:inline-block;
    border: 1px solid #000;
    padding:15px;
    float:left; 
    } 
    
    .center {text-align: center;}
    .right {text-align: right;}
    
    </style>
    
    <table>
    <tr>
      <td width='200' bgcolor='pink'><a href='' class='box center'>box</a></td>
      <td width='200' bgcolor='yellow'><a href='' class='box right'>box</a></td>
    </tr>
    </table>
    I want to put the first link box on the center of the pink table cell, and the second link box on the right of the yellow table cell.

    But the above code doesn' work correctly.

    How can I make the above code correctly?
    Get my greedy up

  • #2
    Senior Coder Spudhead's Avatar
    Join Date
    Jun 2002
    Location
    London, UK
    Posts
    1,856
    Thanks
    8
    Thanked 110 Times in 109 Posts
    Probably not the answer you're looking for but I'd have done it like this:

    Code:
    <style>
    
    a.box{  
    	display:inline-block;
    	border: 1px solid #000;
    	padding:15px;
    } 
    
    </style>
    
    <table>
    	<tr>
    		<td width="200" bgcolor="pink" align="center"><a href="" class="box">box</a></td>
    		<td width="200" bgcolor="yellow" align="right"><a href="" class="box">box</a></td>
    	</tr>
    </table>

  • #3
    Regular Coder mlse's Avatar
    Join Date
    Mar 2005
    Posts
    624
    Thanks
    20
    Thanked 19 Times in 18 Posts
    Code:
    <html>
      <head>
        <style>      
          a.box{  
          display:inline-block;
          border: 1px solid #000;
          padding:15px;
          } 
    
          td.wide {width:200px}
          
          td.center {text-align:center}
          td.right {text-align:right}
        </style>
      </head>
      
      <body>
        <table>
          <tr>
    	<td bgcolor='pink' class='wide center'><a href='' class='box'>box</a></td>
    	<td bgcolor='yellow' class='wide right'><a href='' class='box'>box</a></td>
          </tr>
        </table>
      </body>
    </html>
    Die Welt ist ein Irrenhaus und hier ist die Zentrale!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •