2013-06-19 15 views
-1

我有一箇中間有很多項目的網頁,我想在頁面左上角添加一些小文本,上面寫着「您已登錄如用戶名「。任何想法如何做到這一點?如何將文本對齊屏幕的一角

編輯:我的HTML頁面

<p style="position:fixed;top:0:right:0;color:blue" size="2">You are logged in as: {{ 
<body style="margin-left:100;margin-top:50"> 
    <table border="2"> 
     <tr> 
      <th>Name</th> 
      <th>Created By</th> 
      <th>IP Range</th> 
      <th>Date to Run</th> 
     </tr> 
     <form id="checkboxes" method="post" action="myurl"> 
      <tr> 
       <td><input type="checkbox" name="checkable" /></td> 
       <td><a href="mysecondurl">name</a></td> 
       <td>user</td> 
       <td>ip</td> 
       <td>time</td> 
      </tr> 

      <select id="dropdown"> 
       <option /> 
       <option value="Delete">Delete</option> 
       <option value="Change">Change</option> 
      </select> 
      <input type="hidden" name="isDeleting" value="True"/> 
      <input type="submit" value="Go" /> 
     </form> 
    </table><br /> 
    <form method="post" action="{% url 'Minion.views.add' %}"> 
     <input type="submit" value="Add" /> 
    </form> 
    <form method="post" action="{% url 'Minion.views.index' %}"> 
     <input type="hidden" name="loggingOut" value="True"> 
     <input type="submit" value="Logout" /> 
    </form> 
</body> 

這與下面給出的建議,它只是疊加在頁面的標題的用戶名文本。

+0

準備一個簡單的jsfiddle來演示你想要的東西可能會更適合你。 – Lion

+0

你是什麼意思? – avorum

+1

一種可能的方法是使用絕對定位。 – Nelson

回答

1

這取決於:左上角是什麼?瀏覽器窗口?在這種情況下,您可以考慮使用position: fixed將其永久固定到左上角。或者只是將它作爲您網頁上的第一項。

0
#userDiv { 
position: fixed; 
top: 0; 
left: 0; 
} 

你可以讓你的文本在這個div裏面。

相關問題