2012-03-07 124 views
3

对准我有一个排的两个columns.I表要对准右侧第二列的内容...我的内容没有对齐right..Can你检查什么错在那里.......td标签内容不向右

这里是我的代码....

<html><head>                                
<meta http-equiv="content-type" content="text/html; charset=utf-8"> 
<meta http-equiv="content-style-type" content="text/css">                            <style> 

table td{ 
border:1px solid green; 
} 

#Paginator ul{ margin:0px;padding:0px;} 
#Paginator ul li{ font-family::Arial,Tahoma,helvetica,sans-serif;font-size:9pt;list-style:none;float:left;margin:2px;padding:4px 8px 2px 8px;border:1px solid  black;cursor:pointer;} 
#Paginator ul li,#PrevPage{display:none;} 
</style>  

<body> 

<table style="border:1px solid red;width:100%"><tr> 
    <td> 
    <b style="float:left;">Number of Matching Addresses:&nbsp; 49 &nbspNumber of pages: 5</b> 
</td> 

<td align="right"> 

<script> 

var ga_pageId = new Array(); 
function pageNavigate(){if(document.getElementById("FromPage")){ var fromPage = parseInt(document.getElementById("FromPage").value);} if(document.getElementById("ToPage")){var toPage = parseInt(document.getElementById("ToPage").value);}if(fromPage == 1){document.getElementById("PrevPage").style.display="none";} else{ document.getElementById("PrevPage").style.display="inline"; }if(toPage == 5 || toPage<5){document.getElementById("NextPage").style.display="none";}else{ document.getElementById("NextPage").style.display="inline"; }for(var j=0;j<ga_pageId.length;j++){if(document.getElementById(ga_pageId[j])){document.getElementById(ga_pageId[j]).style.display="none"}}for(var i=fromPage;i<=toPage; i++){ var pageId = 'PAGE_'+i;if(document.getElementById(pageId))document.getElementById(pageId).style.display="inline"; }} 

function previousPage(){var fromPageEle = document.getElementById("FromPage");var toPageEle = document.getElementById("ToPage");if(fromPageEle && toPageEle){fromPageEle.value = parseInt(fromPageEle.value) - 1;toPageEle.value = parseInt(toPageEle.value) - 1;pageNavigate();}} 

function nextPage(){var fromPageEle = document.getElementById("FromPage");var toPageEle = document.getElementById("ToPage");if(fromPageEle && toPageEle){fromPageEle.value = parseInt(fromPageEle.value) + 1;toPageEle.value = parseInt(toPageEle.value) + 1; pageNavigate();}} 

function pageOver(lv_this){if(lv_this.selected!='X')lv_this.style.backgroundColor = "#52CFCF";} 
function pageOut(lv_this){if(lv_this.selected!='X')lv_this.style.backgroundColor = "#E6EFFA";} 

</script> 

    <div id="Paginator"> 
    <input type="hidden" id="FromPage" value="1"/> 
    <input type="hidden" id="ToPage" value="5 "/> 
    <ul > 

     <li onClick="previousPage()" id="PrevPage"><span>PREV</span></li> 
     <script> ga_pageId.push('PAGE_1');</script> 

     <li id="PAGE_1">1 </span></li> 
     <script> ga_pageId.push('PAGE_2');</script> 

     <li id="PAGE_2" >2 </span></li> 
     <script> ga_pageId.push('PAGE_3');</script> 

     <li id="PAGE_3" >3 </span></li><script> ga_pageId.push('PAGE_4');</script> 

     <li id="PAGE_4">4 </span></li> 
     <script> ga_pageId.push('PAGE_5');</script> 

     <li id="PAGE_5">5 </span> 
     </li> 
     <li onClick="nextPage()" id="NextPage" style="display:none"><span>NEXT</span></li> 
    </ul> </div> 

<script> pageNavigate()</script> 

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

</body></html>                                                                                                                                                
+0

不要张贴无用的javascript墙。发布页面的核心细节/布局。无论如何,这个html是一团糟。你不应该在表格单元格中嵌入脚本,反正在标签中使用'align'是不推荐的。为什么不'''? – 2012-03-07 16:05:38

+0

@Rama你有答案吗?这是你正在寻找还是别的什么? – w3uiguru 2012-03-07 16:25:08

回答

3

添加这个CSS:

#Paginator ul{ margin:0px;padding:0px; float:right;} 
-1

因为你的内容被包裹在一个div。 div展开为td的大小,其中的内容左对齐。将text-align: right添加到Paginator ul li风格。

+0

亲爱的你不会努力尝试做到这一点。 – w3uiguru 2012-03-07 16:10:32

1

你已经有答案在你以前<TD>标签style="float:left;"。 为什么你不使用相同的第二<TD>

You can use the Following options 
    1. <td style="float:right;"> 
    2. <div id="Paginator" style="float:right;" > 
    3. #Paginator ul{ margin:0px;padding:0px; float:right;}