'vertical-align' Example : vertical align « CSS « HTML / CSS

HTML / CSS » CSS » vertical align 
'vertical-align' Example
  
    
<html>
<body>
<table width="70%" border="1" cellspacing="5" cellpadding="5">
   <tr height="50">
      <td>Cell content</td>
      <td>Cell content</td>
   </tr>
   <tr height="100" id="myT">
       <td><img src="http://www.java2s.com/style/logo.png">Cell text content</td>
       <td>Cell text content</td>
   </tr>
</table>
<br>
<input type="button" 
       onclick="myT.style.verticalAlign='text-top'" 
       value="Set verticalAlign to text-top">
<input type="button" 
       onclick="myT.style.verticalAlign='text-bottom'" 
       value="Set verticalAlign to text-bottom">
<input type="button" 
       onclick="myT.style.verticalAlign='top'" 
       value="Set verticalAlign to top">
<input type="button" 
       onclick="myT.style.verticalAlign='bottom'" 
       value="Set verticalAlign to bottom">
<input type="button" 
       onclick="myT.style.verticalAlign='auto'" 
       value="Restore position">
</body>
</html>

    
      
        
    
  
Related examples in the same category
1.vertical-align possible values
2.vertical-align: text-bottom
3.vertical align: baseline
4.vertical-align: text-top
5.vertical align: middle
6.vertical align: bottom
7.vertical-align: super
8.vertical-align: sub
9.vertical-align: top;
10.vertical-align: bottom;
11.vertical-align: 300%;
12.vertical-align: 69px;
13.vertical-align: baseline;
14.vertical-align: middle;
15.vertical-align: text-bottom;
16.vertical-align: 200%;
17.vertical-align: 46px;
18.vertical align 20px
19.vertical align 20px for image
20.vertical align 100 percent
21.vertical align 100 percent image
22.vertical align bottom
23.vertical align bottom for image
24.vertical align middle for image
25.vertical align: sub and super
26.vertical align table cells
27.vertical-align:baseline;sub;super;top;text-top;middle;bottom;text-bottom;
28.text vertical align: baseline top middle bottom
29.vertical align text: top and bottom
30.vertical-align: 300%
31.vertical align: sub
32.vertical align: super
33.vertical-align: middle
34.Vertical align elements of different heights
35.Aligned to baseline, lowered to baseline and raised to baseline
36.The image is vertically aligned using the value top
37.The image is vertically aligned using the value text-bottom
38.The image is vertically aligned using the value text-top
39.The image is vertically aligned using the value baseline
40.The image is vertically aligned using the value middle
41.The image is vertically aligned using the value sub
42.The image is vertically aligned using the value super
43.text vertical align top and bottom
44.The length is offset from the bottom of the line-height.
45.The percentage value is a percentage of the line-height value
46.The text-top and text-bottom keyword align to the tallest and lowest character, respectively.
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.