CSS元素POSITION的用法一例

2021-08-22 05:39:36 字數 1042 閱讀 6051

css元素position的用法一例

左直拳頁面上用到了atlas的控制項<

atlas

:updateprogress,以便在進行各種操作時顯示乙個等待圖示,給使用者解解悶,好讓他們在漫長的等待結果的歲月中不那麼煩躁,知道系統正在忙。

形如:<

atlas

:updateprogress

id="updateprogress1"

runat

="server"

>

<

progresstemplate

>

<

imgsrc

="../images/loading.gif"

alt="

請稍候..."

/>

progresstemplate

>

atlas

:updateprogress

>

可是這樣寫的話圖示就歪在一邊,不顯眼。如果寫上個絕對定位,比如

style

="position:absolute;left:400px;top:300px;"

,可這僅僅適合800*600的螢幕,而使用者的螢幕解析度千差萬別。

最後發覺可以用百分比,這樣寫:

<

atlas

:updateprogress

id="updateprogress1"

runat

="server"

>

<

progresstemplate

>

<

imgsrc

="../images/loading.gif"

alt="

請稍候..."

style

="position:absolute;left:50%;top:50%;"/>

progresstemplate

>

atlas

:updateprogress

>

這樣不管什麼情況下,圖示都會居於頁面之中。

css中元素的定位 position

網頁中元素的定位使用position屬性。position的可用值有 預設值。沒有定位,元素出現在正常的流中 忽略 top,bottom,left,right 或者 z index 宣告 生成絕對定位的元素,相對於瀏覽器視窗進行定位。元素的位置通過 left top right 以及 bottom ...

CSS元素之position 定位

值 屬性inhert 規定應該從父元素繼承 position 屬性的值。static 預設值。沒有定位,元素出現在正常的流中 忽略 top,bottom,left,right 或者 z index 宣告 relative 生成相對定位的元素,相對於元素本身正常位置進行定位。因此,left 20 會向...

css中元素的position屬性詳解

position屬性有五個可以設定的值,分別是static,absolute,relative,fixed,inherit static 預設值,無定位 元素仍然存在於標準文件流中 absolute 絕對定位,元素相對於它的第乙個定位父級元素進行定位。元素的位置可以通過top,right,botto...