我的問題的設置很簡單:我想要一個元素的背景圖像以左邊緣位於中間的左側和右側它的容器。因此,像如何在水平中點處設置背景圖像位置的左邊緣
HTML
<div class="image-on-right" id="this-dude">
<div class="text-holder">
<p>His arms spaghetti, knees weak, palms spaghetti. There's spaghetti on his sweater already, mom's spaghetti. He's nervous, but on the surface he looks calm spaghetti.
</div>
</div>
CSS
.image-on-right { background-repeat: no-repeat; background-position-x: 50%; background-size: contain; }
.image-on-right > .text-holder { width: 50%; }
#this-dude { background-image: url(http://i.ytimg.com/vi/mEPV2I6dgRM/hqdefault.jpg); }
(https://jsfiddle.net/e78xbuna/)
除了有背景圖像有其中心在50%大關,而不是它的左側爲50%。所以,如果有一個屬性,我可以申請像background-position-translate: translateX(-50%);
,這將是我正在尋找。