CSS-背景位置-x|background-position-x
ackground-position-x
CSS 屬性設定水平方向的位置,與每個背景圖片等位置層設定屬性 background-origin
相關。更多資訊請檢視background-position
屬性,這個用的比較普遍。
/* Keyword values */ background-position-x: left; background-position-x: center; background-position-x: right; /* <percentage> values */ background-position-x: 25%; /* <length> values */ background-position-x: 0px; background-position-x: 1cm; background-position-x: 8em; /* side-relative values */ background-position-x: right 3px; background-position-x: left 25%; /* Multiple values */ background-position-x: 0px, center; /* Global values */ background-position-x: inherit; background-position-x: initial; background-position-x: unset;
注意:這個屬性的值會被後面宣告的屬性覆蓋掉,如background
和background-position
等簡寫的屬性。
初始值 |
left |
---|---|
適用元素 |
all elements |
是否是繼承屬性 |
no |
Percentages |
refer to width of background positioning area minus height of background image |
適用媒體 |
visual |
計算值 |
A list, each item consisting of: an offset given as a combination of an absolute length and a percentage, plus an origin keyword |
Animation type |
discrete |
正規順序 |
the unique non-ambiguous order defined by the formal grammar |
語法
值
left
在位置層上相對於左邊的位置。center
在位置層上相對於中間點的位置。right
在位置層上相對於右邊的位置。<length>
<length>
值是定義相對於位置層邊緣的距離,邊緣預設為左邊。<percentage>
<percentage>
值是定義相對於位置層邊緣的距離百分比,邊緣預設為左邊。
正式語法
[ center | [ left | right | x-start | x-end ]? <length-percentage>? ]#where <length-percentage> = <length> | <percentage>
規範
Specification |
Status |
Comment |
---|---|---|
CSS Backgrounds and Borders Module Level 4The definition of `background-position-x` in that specification. |
Editor`s Draft |
Initial specification of longhand sub properties of background-position to match longstanding implementations. |
瀏覽器相容性
Feature |
Chrome |
Firefox |
Edge |
Internet Explorer |
Opera |
Safari |
---|---|---|---|---|---|---|
Basic Support |
(Yes) |
49.0 |
12 |
6 |
(Yes) |
(Yes) |
Two-value syntax (support for offsets from any edge) |
(No) |
49.0 |
12 |
9.0 |
(No) |
(No) |
Feature |
Android |
Chrome for Android |
Edge mobile |
Firefox for Android |
IE mobile |
Opera Android |
iOS Safari |
---|---|---|---|---|---|---|---|
Basic Support |
(Yes) |
(Yes) |
(Yes) |
49.0 |
? |
? |
? |
Two-value syntax (support for offsets from any edge) |
(No) |
(No) |
(Yes) |
49.0 |
? |
(No) |
(No) |
另見
background-position
background-position-y
- 多重背景(Multiple backgrounds)
相關文章
- CSS-背景顏色|background-colorCSS
- CSS-背景圖片|background-imageCSS
- CSS-實戰-梯形背景導航CSS
- CSS-背景來源|background-originCSS
- JavaScript設定背景圖片位置JavaScript
- CSS如何控制背景圖片的位置CSS
- 如何實現text起始位置設定背景色
- css-居中篇CSS
- CSS-文字格式CSS
- CSS-語法CSS
- css-盒模型CSS模型
- CSS-清除浮動CSS
- quick-cocos2d-x :加入精靈背景UI
- CSS-伸縮佈局CSS
- css-媒體查詢CSS
- 深入解析css-筆記CSS筆記
- CSS-定位7-BFCCSS
- 適配iPhone X Push過程中TabBar位置上移iPhonetabBar
- win10背景圖片在哪個資料夾_win10桌面背景圖片檔案位置怎麼開啟Win10
- CSS-返回頂部程式碼CSS
- CSS-多列布局1-概述CSS
- css-虛線邊框滾動效果CSS
- CSS-實戰-上傳按鈕美化CSS
- CSS-盒子模型-邊距合併CSS模型
- Less動態css-演講稿(ppt)CSS
- CSS-行內框、行框、行高CSS
- css-水平居中、垂直居中(初級篇)CSS
- CSS-多列布局2-斷行CSS
- CSS-多列布局3-瀑布流CSS
- CSS-實戰-互動式圖片CSS
- win10桌布在哪個資料夾 win10桌面背景圖片檔案位置Win10
- Cocos2d-x優化中關於背景圖片優化優化
- 那些你需要知道的CSS-總結CSS
- 第 2 章 HTML、XML和CSS-帶答案HTMLXMLCSS
- CSS-彈性佈局2-交叉軸CSS
- CSS-佈局5-Calc三列布局CSS
- css-製作三角形方法CSS
- CSS-選擇器6-兄弟選擇器CSS